Skip to content

Commit

Permalink
pythongh-128400: Stop the world when calling manually
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroIntensity committed Jan 2, 2025
1 parent e389d6c commit a8cf48a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Modules/faulthandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ faulthandler_dump_traceback_py(PyObject *self,
return NULL;

if (all_threads) {
PyInterpreterState *interp = _PyInterpreterState_GET();
/* gh-128400: Accessing other thread states while they're running
* isn't safe if those threads are running. */
_PyEval_StopTheWorld(interp);
errmsg = _Py_DumpTracebackThreads(fd, NULL, tstate);
_PyEval_StartTheWorld(interp);
if (errmsg != NULL) {
PyErr_SetString(PyExc_RuntimeError, errmsg);
return NULL;
Expand Down

0 comments on commit a8cf48a

Please sign in to comment.