summaryrefslogtreecommitdiffstats
path: root/Include/traceback.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-16 21:45:24 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-16 21:45:24 (GMT)
commit861d9abfcf6a4a34790e4edc5e440a68534137e1 (patch)
treea4ea3ef14a2f0494743733b9db4079f27f5906ca /Include/traceback.h
parentc36674a2c52ecb30e180b3bcced2b8c529cf72fb (diff)
downloadcpython-861d9abfcf6a4a34790e4edc5e440a68534137e1.zip
cpython-861d9abfcf6a4a34790e4edc5e440a68534137e1.tar.gz
cpython-861d9abfcf6a4a34790e4edc5e440a68534137e1.tar.bz2
faulthandler now works in non-Python threads
Issue #26563: * Add _PyGILState_GetInterpreterStateUnsafe() function: the single PyInterpreterState used by this process' GILState implementation. * Enhance _Py_DumpTracebackThreads() to retrieve the interpreter state from autoInterpreterState in last resort. The function now accepts NULL for interp and current_tstate parameters. * test_faulthandler: fix a ResourceWarning when test is interrupted by CTRL+c
Diffstat (limited to 'Include/traceback.h')
-rw-r--r--Include/traceback.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/Include/traceback.h b/Include/traceback.h
index 7c630e3..76e169a 100644
--- a/Include/traceback.h
+++ b/Include/traceback.h
@@ -53,19 +53,32 @@ PyAPI_DATA(void) _Py_DumpTraceback(
PyThreadState *tstate);
/* Write the traceback of all threads into the file 'fd'. current_thread can be
- NULL. Return NULL on success, or an error message on error.
+ NULL.
+
+ Return NULL on success, or an error message on error.
This function is written for debug purpose only. It calls
_Py_DumpTraceback() for each thread, and so has the same limitations. It
only write the traceback of the first 100 threads: write "..." if there are
more threads.
+ If current_tstate is NULL, the function tries to get the Python thread state
+ of the current thread. It is not an error if the function is unable to get
+ the current Python thread state.
+
+ If interp is NULL, the function tries to get the interpreter state from
+ the current Python thread state, or from
+ _PyGILState_GetInterpreterStateUnsafe() in last resort.
+
+ It is better to pass NULL to interp and current_tstate, the function tries
+ different options to retrieve these informations.
+
This function is signal safe. */
PyAPI_DATA(const char*) _Py_DumpTracebackThreads(
- int fd, PyInterpreterState *interp,
- PyThreadState *current_thread);
-
+ int fd,
+ PyInterpreterState *interp,
+ PyThreadState *current_tstate);
#ifndef Py_LIMITED_API