Commits

Victor Stinner committed abf23c2 Draft

Issue #5969: faulthandler module: rename dump_tracebacks_later() to
dump_traceback_later() and cancel_dump_tracebacks_later() to
cancel_dump_traceback_later().

Comments (0)

Files changed (4)

Doc/library/faulthandler.rst

 Dump the tracebacks after a timeout
 -----------------------------------
 
-.. function:: dump_tracebacks_later(timeout, repeat=False, file=sys.stderr, exit=False)
+.. function:: dump_traceback_later(timeout, repeat=False, file=sys.stderr, exit=False)
 
    Dump the tracebacks of all threads, after a timeout of *timeout* seconds, or
    every *timeout* seconds if *repeat* is ``True``.  If *exit* is ``True``, call
    This function is implemented using a watchdog thread and therefore is not
    available if Python is compiled with threads disabled.
 
-.. function:: cancel_dump_tracebacks_later()
+.. function:: cancel_dump_traceback_later()
 
-   Cancel the last call to :func:`dump_tracebacks_later`.
+   Cancel the last call to :func:`dump_traceback_later`.
 
 
 Dump the traceback on a user signal
 File descriptor issue
 ---------------------
 
-:func:`enable`, :func:`dump_tracebacks_later` and :func:`register` keep the
+:func:`enable`, :func:`dump_traceback_later` and :func:`register` keep the
 file descriptor of their *file* argument. If the file is closed and its file
 descriptor is reused by a new file, or if :func:`os.dup2` is used to replace
 the file descriptor, the traceback will be written into a different file. Call

Lib/test/test_faulthandler.py

         with temporary_filename() as filename:
             self.check_dump_traceback_threads(filename)
 
-    def _check_dump_tracebacks_later(self, repeat, cancel, filename, loops):
+    def _check_dump_traceback_later(self, repeat, cancel, filename, loops):
         """
         Check how many times the traceback is written in timeout x 2.5 seconds,
         or timeout x 3.5 seconds if cancel is True: 1, 2 or 3 times depending
 
 def func(timeout, repeat, cancel, file, loops):
     for loop in range(loops):
-        faulthandler.dump_tracebacks_later(timeout, repeat=repeat, file=file)
+        faulthandler.dump_traceback_later(timeout, repeat=repeat, file=file)
         if cancel:
-            faulthandler.cancel_dump_tracebacks_later()
+            faulthandler.cancel_dump_traceback_later()
         time.sleep(timeout * 5)
-        faulthandler.cancel_dump_tracebacks_later()
+        faulthandler.cancel_dump_traceback_later()
 
 timeout = {timeout}
 repeat = {repeat}
             self.assertEqual(trace, '')
         self.assertEqual(exitcode, 0)
 
-    @unittest.skipIf(not hasattr(faulthandler, 'dump_tracebacks_later'),
-                     'need faulthandler.dump_tracebacks_later()')
-    def check_dump_tracebacks_later(self, repeat=False, cancel=False,
+    @unittest.skipIf(not hasattr(faulthandler, 'dump_traceback_later'),
+                     'need faulthandler.dump_traceback_later()')
+    def check_dump_traceback_later(self, repeat=False, cancel=False,
                                     file=False, twice=False):
         if twice:
             loops = 2
             loops = 1
         if file:
             with temporary_filename() as filename:
-                self._check_dump_tracebacks_later(repeat, cancel,
+                self._check_dump_traceback_later(repeat, cancel,
                                                   filename, loops)
         else:
-            self._check_dump_tracebacks_later(repeat, cancel, None, loops)
+            self._check_dump_traceback_later(repeat, cancel, None, loops)
 
-    def test_dump_tracebacks_later(self):
-        self.check_dump_tracebacks_later()
+    def test_dump_traceback_later(self):
+        self.check_dump_traceback_later()
 
-    def test_dump_tracebacks_later_repeat(self):
-        self.check_dump_tracebacks_later(repeat=True)
+    def test_dump_traceback_later_repeat(self):
+        self.check_dump_traceback_later(repeat=True)
 
-    def test_dump_tracebacks_later_cancel(self):
-        self.check_dump_tracebacks_later(cancel=True)
+    def test_dump_traceback_later_cancel(self):
+        self.check_dump_traceback_later(cancel=True)
 
-    def test_dump_tracebacks_later_file(self):
-        self.check_dump_tracebacks_later(file=True)
+    def test_dump_traceback_later_file(self):
+        self.check_dump_traceback_later(file=True)
 
-    def test_dump_tracebacks_later_twice(self):
-        self.check_dump_tracebacks_later(twice=True)
+    def test_dump_traceback_later_twice(self):
+        self.check_dump_traceback_later(twice=True)
 
     @unittest.skipIf(not hasattr(faulthandler, "register"),
                      "need faulthandler.register")
 Library
 -------
 
+- Issue #5969: faulthandler module: rename dump_tracebacks_later() to
+  dump_traceback_later() and cancel_dump_tracebacks_later() to
+  cancel_dump_traceback_later().
 
 What's New in Python 3.3.0 Release Candidate 2?
 ===============================================

Modules/faulthandler.c

 }
 
 static void
-cancel_dump_tracebacks_later(void)
+cancel_dump_traceback_later(void)
 {
     /* Notify cancellation */
     PyThread_release_lock(thread.cancel_event);
 }
 
 static PyObject*
-faulthandler_dump_tracebacks_later(PyObject *self,
+faulthandler_dump_traceback_later(PyObject *self,
                                    PyObject *args, PyObject *kwargs)
 {
     static char *kwlist[] = {"timeout", "repeat", "file", "exit", NULL};
     size_t header_len;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-        "d|iOi:dump_tracebacks_later", kwlist,
+        "d|iOi:dump_traceback_later", kwlist,
         &timeout, &repeat, &file, &exit))
         return NULL;
     if ((timeout * 1e6) >= (double) PY_TIMEOUT_MAX) {
     header_len = strlen(header);
 
     /* Cancel previous thread, if running */
-    cancel_dump_tracebacks_later();
+    cancel_dump_traceback_later();
 
     Py_XDECREF(thread.file);
     Py_INCREF(file);
 }
 
 static PyObject*
-faulthandler_cancel_dump_tracebacks_later_py(PyObject *self)
+faulthandler_cancel_dump_traceback_later_py(PyObject *self)
 {
-    cancel_dump_tracebacks_later();
+    cancel_dump_traceback_later();
     Py_RETURN_NONE;
 }
 #endif  /* FAULTHANDLER_LATER */
                "dump the traceback of the current thread, or of all threads "
                "if all_threads is True, into file")},
 #ifdef FAULTHANDLER_LATER
-    {"dump_tracebacks_later",
-     (PyCFunction)faulthandler_dump_tracebacks_later, METH_VARARGS|METH_KEYWORDS,
-     PyDoc_STR("dump_tracebacks_later(timeout, repeat=False, file=sys.stderrn, exit=False):\n"
+    {"dump_traceback_later",
+     (PyCFunction)faulthandler_dump_traceback_later, METH_VARARGS|METH_KEYWORDS,
+     PyDoc_STR("dump_traceback_later(timeout, repeat=False, file=sys.stderrn, exit=False):\n"
                "dump the traceback of all threads in timeout seconds,\n"
                "or each timeout seconds if repeat is True. If exit is True, "
                "call _exit(1) which is not safe.")},
-    {"cancel_dump_tracebacks_later",
-     (PyCFunction)faulthandler_cancel_dump_tracebacks_later_py, METH_NOARGS,
-     PyDoc_STR("cancel_dump_tracebacks_later():\ncancel the previous call "
-               "to dump_tracebacks_later().")},
+    {"cancel_dump_traceback_later",
+     (PyCFunction)faulthandler_cancel_dump_traceback_later_py, METH_NOARGS,
+     PyDoc_STR("cancel_dump_traceback_later():\ncancel the previous call "
+               "to dump_traceback_later().")},
 #endif
 
 #ifdef FAULTHANDLER_USER
 #ifdef FAULTHANDLER_LATER
     /* later */
     if (thread.cancel_event) {
-        cancel_dump_tracebacks_later();
+        cancel_dump_traceback_later();
         PyThread_release_lock(thread.cancel_event);
         PyThread_free_lock(thread.cancel_event);
         thread.cancel_event = NULL;