Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-128400: Stop the world when calling manually
  • Loading branch information
ZeroIntensity committed Jan 2, 2025
commit a8cf48a886319c98b38ecb750b2c7a1299cb4ecd
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