PyOS_AfterFork_Child() pass tstate to _PyEval_ReInitThreads() (GH-20598)

This commit is contained in:
Victor Stinner 2020-06-02 18:44:54 +02:00 committed by GitHub
parent 45b34a04a5
commit 317bab0bf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View file

@ -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: