File tree 3 files changed +9
-6
lines changed 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ PyAPI_FUNC(int) _PyEval_AddPendingCall(
25
25
void * arg );
26
26
PyAPI_FUNC (void ) _PyEval_SignalAsyncExc (PyThreadState * tstate );
27
27
#ifdef HAVE_FORK
28
- extern PyStatus _PyEval_ReInitThreads (struct pyruntimestate * runtime );
28
+ extern PyStatus _PyEval_ReInitThreads (PyThreadState * tstate );
29
29
#endif
30
30
PyAPI_FUNC (void ) _PyEval_SetCoroutineOriginTrackingDepth (
31
31
PyThreadState * tstate ,
Original file line number Diff line number Diff line change @@ -470,7 +470,10 @@ PyOS_AfterFork_Child(void)
470
470
goto fatal_error ;
471
471
}
472
472
473
- status = _PyEval_ReInitThreads (runtime );
473
+ PyThreadState * tstate = _PyThreadState_GET ();
474
+ _Py_EnsureTstateNotNULL (tstate );
475
+
476
+ status = _PyEval_ReInitThreads (tstate );
474
477
if (_PyStatus_EXCEPTION (status )) {
475
478
goto fatal_error ;
476
479
}
@@ -491,8 +494,9 @@ PyOS_AfterFork_Child(void)
491
494
if (_PyStatus_EXCEPTION (status )) {
492
495
goto fatal_error ;
493
496
}
497
+ assert (_PyThreadState_GET () == tstate );
494
498
495
- run_at_forkers (_PyInterpreterState_GET () -> after_forkers_child , 0 );
499
+ run_at_forkers (tstate -> interp -> after_forkers_child , 0 );
496
500
return ;
497
501
498
502
fatal_error :
Original file line number Diff line number Diff line change @@ -436,10 +436,9 @@ PyEval_ReleaseThread(PyThreadState *tstate)
436
436
which are not running in the child process, and clear internal locks
437
437
which might be held by those threads. */
438
438
PyStatus
439
- _PyEval_ReInitThreads (_PyRuntimeState * runtime )
439
+ _PyEval_ReInitThreads (PyThreadState * tstate )
440
440
{
441
- PyThreadState * tstate = _PyRuntimeState_GetThreadState (runtime );
442
- _Py_EnsureTstateNotNULL (tstate );
441
+ _PyRuntimeState * runtime = tstate -> interp -> runtime ;
443
442
444
443
#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
445
444
struct _gil_runtime_state * gil = & tstate -> interp -> ceval .gil ;
You can’t perform that action at this time.
0 commit comments