summaryrefslogtreecommitdiff
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-24 15:20:23 +0200
committerGitHub <noreply@github.com>2019-05-24 15:20:23 +0200
commitb49858b4b7b4c9d85ef6946ad020f83e4fa1caa7 (patch)
tree00d448bec735ee1de48c9cf5ab88ea1720d8f4ae /Modules/posixmodule.c
parentb3a9843cd19039808a812ca11206881c94c64e3b (diff)
downloadcpython-git-b49858b4b7b4c9d85ef6946ad020f83e4fa1caa7.tar.gz
bpo-37031: Fix PyOS_AfterFork_Child() (GH-13537)
PyOS_AfterFork_Child(): _PyInterpreterState_DeleteExceptMain() must be called after _PyRuntimeState_ReInitThreads(). _PyRuntimeState_ReInitThreads() resets interpreters mutex after fork, mutex used by _PyInterpreterState_DeleteExceptMain().
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 8ebe3a0be0..cd5b5ce082 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -448,11 +448,11 @@ PyOS_AfterFork_Child(void)
{
_PyRuntimeState *runtime = &_PyRuntime;
_PyGILState_Reinit(runtime);
- _PyInterpreterState_DeleteExceptMain(runtime);
_PyEval_ReInitThreads(runtime);
_PyImport_ReInitLock();
_PySignal_AfterFork();
_PyRuntimeState_ReInitThreads(runtime);
+ _PyInterpreterState_DeleteExceptMain(runtime);
run_at_forkers(_PyInterpreterState_Get()->after_forkers_child, 0);
}