(original) (raw)
changeset: 100566:ce62df22f3bf branch: 3.5 parent: 100564:73d8adc0d5ea user: Victor Stinner victor.stinner@gmail.com date: Wed Mar 16 23:19:15 2016 +0100 files: Python/pylifecycle.c description: Py_FatalError: disable faulthandler earlier Issue #26563: Py_FatalError: disable faulthandler before trying to flush sys.stdout and sys.stderr. diff -r 73d8adc0d5ea -r ce62df22f3bf Python/pylifecycle.c --- a/Python/pylifecycle.c Wed Mar 16 23:25:02 2016 +0100 +++ b/Python/pylifecycle.c Wed Mar 16 23:19:15 2016 +0100 @@ -1354,17 +1354,17 @@ if (!_Py_FatalError_PrintExc(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 */ if (PyThreadState_GET() != NULL) { /* Flush sys.stdout and sys.stderr */ 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 len = strlen(msg); /victor.stinner@gmail.com