diff options
Diffstat (limited to 'src/if_python.c')
-rw-r--r-- | src/if_python.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/if_python.c b/src/if_python.c index c194598b7..2a53c93b0 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -740,9 +740,11 @@ Python_Init(void) #else PyMac_Initialize(); #endif - /* initialise threads */ + /* Initialise threads and save the state using PyGILState_Ensure. + * Without this call, thread-specific state (such as the system trace + * hook), will be lost between invocations of Python code. */ PyEval_InitThreads(); - + pygilstate = PyGILState_Ensure(); #ifdef DYNAMIC_PYTHON get_exceptions(); #endif |