summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/signalmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 87c1c9a..32cd8bb 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -991,11 +991,13 @@ void
PyOS_AfterFork(void)
{
#ifdef WITH_THREAD
+ /* PyThread_ReInitTLS() must be called early, to make sure that the TLS API
+ * can be called safely. */
+ PyThread_ReInitTLS();
_PyGILState_Reinit();
PyEval_ReInitThreads();
main_thread = PyThread_get_thread_ident();
main_pid = getpid();
_PyImport_ReInitLock();
- PyThread_ReInitTLS();
#endif
}