gh-116522: Stop the world before fork() and during shutdown by colesbury · Pull Request #116607 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
28 changes: 21 additions & 7 deletions Modules/posixmodule.c
3 changes: 3 additions & 0 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,9 @@ Py_FinalizeEx(void)
int malloc_stats = tstate->interp->config.malloc_stats;
#endif

/* Ensure that remaining threads are detached */
_PyEval_StopTheWorldAll(runtime);
Comment thread
gpshead marked this conversation as resolved.

/* Remaining daemon threads will automatically exit
when they attempt to take the GIL (ex: PyEval_RestoreThread()). */
_PyInterpreterState_SetFinalizing(tstate->interp, tstate);
Expand Down
6 changes: 6 additions & 0 deletions Python/pystate.c