mirror of
https://github.com/python/cpython
synced 2026-09-28 08:08:17 +03:00
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
This commit is contained in:
parent
c36674a2c5
commit
861d9abfcf
7 changed files with 164 additions and 48 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue