summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 644d4ba..8867916 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -646,6 +646,7 @@ PyOS_AfterFork_Child(void)
PyThreadState *tstate = _PyThreadState_GET();
_Py_EnsureTstateNotNULL(tstate);
+ assert(tstate->thread_id == PyThread_get_thread_ident());
#ifdef PY_HAVE_THREAD_NATIVE_ID
tstate->native_thread_id = PyThread_get_thread_native_id();
#endif
@@ -655,6 +656,9 @@ PyOS_AfterFork_Child(void)
_Py_qsbr_after_fork((_PyThreadStateImpl *)tstate);
#endif
+ // Ideally we could guarantee tstate is running main.
+ _PyInterpreterState_ReinitRunningMain(tstate);
+
status = _PyEval_ReInitThreads(tstate);
if (_PyStatus_EXCEPTION(status)) {
goto fatal_error;