Commit a2e5e044 authored by Victor Stinner's avatar Victor Stinner

Py_FatalError: disable faulthandler earlier

Issue #26563: Py_FatalError: disable faulthandler before trying to flush
sys.stdout and sys.stderr.
parent 6150f319
...@@ -1354,17 +1354,17 @@ Py_FatalError(const char *msg) ...@@ -1354,17 +1354,17 @@ Py_FatalError(const char *msg)
if (!_Py_FatalError_PrintExc(fd)) if (!_Py_FatalError_PrintExc(fd))
_Py_FatalError_DumpTracebacks(fd); _Py_FatalError_DumpTracebacks(fd);
/* The main purpose of faulthandler is to display the traceback. We already
* did our best to display it. So faulthandler can now be disabled.
* (Don't trigger it on abort().) */
_PyFaulthandler_Fini();
/* Check if the current Python thread hold the GIL */ /* Check if the current Python thread hold the GIL */
if (PyThreadState_GET() != NULL) { if (PyThreadState_GET() != NULL) {
/* Flush sys.stdout and sys.stderr */ /* Flush sys.stdout and sys.stderr */
flush_std_files(); flush_std_files();
} }
/* The main purpose of faulthandler is to display the traceback. We already
* did our best to display it. So faulthandler can now be disabled.
* (Don't trigger it on abort().) */
_PyFaulthandler_Fini();
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
len = strlen(msg); len = strlen(msg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment