summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-06-02 16:44:54 (GMT)
committerGitHub <noreply@github.com>2020-06-02 16:44:54 (GMT)
commit317bab0bf61e4cbab37c81baf185d8b57ca62a6b (patch)
treefb72064426f3bf0c9a91360397bcd0bf651590e0 /Modules/posixmodule.c
parent45b34a04a577aa49fa4825421758c3e8eaa1625d (diff)
downloadcpython-317bab0bf61e4cbab37c81baf185d8b57ca62a6b.zip
cpython-317bab0bf61e4cbab37c81baf185d8b57ca62a6b.tar.gz
cpython-317bab0bf61e4cbab37c81baf185d8b57ca62a6b.tar.bz2
PyOS_AfterFork_Child() pass tstate to _PyEval_ReInitThreads() (GH-20598)
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index afb6d18..79779bf 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -470,7 +470,10 @@ PyOS_AfterFork_Child(void)
goto fatal_error;
}
- status = _PyEval_ReInitThreads(runtime);
+ PyThreadState *tstate = _PyThreadState_GET();
+ _Py_EnsureTstateNotNULL(tstate);
+
+ status = _PyEval_ReInitThreads(tstate);
if (_PyStatus_EXCEPTION(status)) {
goto fatal_error;
}
@@ -491,8 +494,9 @@ PyOS_AfterFork_Child(void)
if (_PyStatus_EXCEPTION(status)) {
goto fatal_error;
}
+ assert(_PyThreadState_GET() == tstate);
- run_at_forkers(_PyInterpreterState_GET()->after_forkers_child, 0);
+ run_at_forkers(tstate->interp->after_forkers_child, 0);
return;
fatal_error: