diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-16 22:45:24 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-16 22:45:24 +0100 |
commit | f170005bfdc09173b855048302a650fa3ef7d16f (patch) | |
tree | 61b7b2b1732cdcc7469f5518de334197b23fefa9 /Include/traceback.h | |
parent | afdcb3072bfeb43e5abe1bc0f7b14feb9d24271d (diff) | |
download | cpython-f170005bfdc09173b855048302a650fa3ef7d16f.tar.gz |
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.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Include/traceback.h b/Include/traceback.h index 7c630e33df..76e169a312 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 |