File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -715,19 +715,21 @@ faulthandler_thread(void *unused)
715715
716716 if (!interp_is_freed (interp )) {
717717
718- #ifdef Py_GIL_DISABLED
719- _PyEval_StopTheWorld (interp );
720- #else
721- PyGILState_STATE gil_state = PyGILState_Ensure ();
722- #endif
723- errmsg = _Py_DumpTracebackThreads (thread .fd , interp , NULL , 1 );
724- ok = (errmsg == NULL );
718+ PyThreadState * ts = PyThreadState_New (interp );
719+ if (ts ) {
720+ _PyThreadState_Attach (ts );
721+ _PyEval_StopTheWorld (interp );
725722
726- #ifdef Py_GIL_DISABLED
727- _PyEval_StartTheWorld (interp );
728- #else
729- PyGILState_Release (gil_state );
730- #endif
723+ errmsg = _Py_DumpTracebackThreads (thread .fd , interp , NULL );
724+ ok = (errmsg == NULL );
725+
726+ _PyEval_StartTheWorld (interp );
727+ PyThreadState_Clear (ts );
728+ PyThreadState_DeleteCurrent ();
729+ }
730+ else {
731+ fprintf (stderr , "faulthandler_thread: PyThreadState_New failed\n" );
732+ }
731733 }
732734
733735
You can’t perform that action at this time.
0 commit comments