bpo-36710: PyOS_AfterFork_Child() pass runtime parameter (GH-12936)

The PyOS_AfterFork_Child() function now pass a 'runtime' parameter to
subfunctions.

* Fix _PyRuntimeState_ReInitThreads(): use the correct memory allocator
* Add runtime parameter to _PyRuntimeState_ReInitThreads(),
  _PyGILState_Reinit() and _PyInterpreterState_DeleteExceptMain()
* Move _PyGILState_Reinit() to the internal C API.
This commit is contained in:
Victor Stinner 2019-04-24 17:14:33 +02:00 committed by GitHub
parent 8bb3230149
commit b930a2d2b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 42 deletions

View file

@ -421,12 +421,13 @@ PyOS_AfterFork_Parent(void)
void
PyOS_AfterFork_Child(void)
{
_PyGILState_Reinit();
_PyInterpreterState_DeleteExceptMain();
_PyRuntimeState *runtime = &_PyRuntime;
_PyGILState_Reinit(runtime);
_PyInterpreterState_DeleteExceptMain(runtime);
PyEval_ReInitThreads();
_PyImport_ReInitLock();
_PySignal_AfterFork();
_PyRuntimeState_ReInitThreads();
_PyRuntimeState_ReInitThreads(runtime);
run_at_forkers(_PyInterpreterState_Get()->after_forkers_child, 0);
}