Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit b49858b

Browse files
authored
bpo-37031: Fix PyOS_AfterFork_Child() (pythonGH-13537)
PyOS_AfterFork_Child(): _PyInterpreterState_DeleteExceptMain() must be called after _PyRuntimeState_ReInitThreads(). _PyRuntimeState_ReInitThreads() resets interpreters mutex after fork, mutex used by _PyInterpreterState_DeleteExceptMain().
1 parent b3a9843 commit b49858b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/posixmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,11 @@ PyOS_AfterFork_Child(void)
448448
{
449449
_PyRuntimeState *runtime = &_PyRuntime;
450450
_PyGILState_Reinit(runtime);
451-
_PyInterpreterState_DeleteExceptMain(runtime);
452451
_PyEval_ReInitThreads(runtime);
453452
_PyImport_ReInitLock();
454453
_PySignal_AfterFork();
455454
_PyRuntimeState_ReInitThreads(runtime);
455+
_PyInterpreterState_DeleteExceptMain(runtime);
456456

457457
run_at_forkers(_PyInterpreterState_Get()->after_forkers_child, 0);
458458
}

0 commit comments

Comments
 (0)