diff options
author | Victor Stinner <vstinner@python.org> | 2020-06-02 16:44:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-02 16:44:54 (GMT) |
commit | 317bab0bf61e4cbab37c81baf185d8b57ca62a6b (patch) | |
tree | fb72064426f3bf0c9a91360397bcd0bf651590e0 /Modules/posixmodule.c | |
parent | 45b34a04a577aa49fa4825421758c3e8eaa1625d (diff) | |
download | cpython-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.c | 8 |
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: |