STINNER Victor added the comment:
> I _believe_ we always want to use _PyThreadState_UncheckedGet()
faulthandler_dump_traceback() uses PyGILState_GetThisThreadState(). There is a
comment to explain why:
/* SIGSEGV, SIGFPE, SIGABRT, SIGBUS and SIGILL are synchronous signals and
are thus delivered to the thread that caused the fault. Get the Python
thread state of the current thread.
PyThreadState_Get() doesn't give the state of the thread that caused the
fault if the thread released the GIL, and so this function cannot be
used. Read the thread local storage (TLS) instead: call
PyGILState_GetThisThreadState(). */
See also test_faulthandler tests, especially tests releasing the GIL:
* test_gil_released()
* test_fatal_error_without_gil()
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30165>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com