diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-16 21:45:24 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-16 21:45:24 (GMT) |
commit | 861d9abfcf6a4a34790e4edc5e440a68534137e1 (patch) | |
tree | a4ea3ef14a2f0494743733b9db4079f27f5906ca /Python/pylifecycle.c | |
parent | c36674a2c52ecb30e180b3bcced2b8c529cf72fb (diff) | |
download | cpython-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 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 4fc6a15..41528cd 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1275,25 +1275,11 @@ initstdio(void) static void _Py_FatalError_DumpTracebacks(int fd) { - PyThreadState *tstate; - -#ifdef WITH_THREAD - /* PyGILState_GetThisThreadState() works even if the GIL was released */ - tstate = PyGILState_GetThisThreadState(); -#else - tstate = PyThreadState_GET(); -#endif - if (tstate == NULL) { - /* _Py_DumpTracebackThreads() requires the thread state to display - * frames */ - return; - } - fputc('\n', stderr); fflush(stderr); /* display the current Python stack */ - _Py_DumpTracebackThreads(fd, tstate->interp, tstate); + _Py_DumpTracebackThreads(fd, NULL, NULL); } /* Print the current exception (if an exception is set) with its traceback, |