diff -r 285d28c3620a Python/pystate.c --- a/Python/pystate.c Thu Nov 14 01:27:12 2013 +0100 +++ b/Python/pystate.c Thu Nov 14 09:27:13 2013 +0100 @@ -771,6 +771,11 @@ PyGILState_Ensure(void) assert(autoInterpreterState); /* Py_Initialize() hasn't been called! */ tcur = (PyThreadState *)PyThread_get_key_value(autoTLSkey); if (tcur == NULL) { + /* At startup, Python has no concrete GIL. If PyGILState_Ensure() is + called from a new thread for the first time, we need the create the + GIL. */ + PyEval_InitThreads(); + /* Create a new thread state for this thread */ tcur = PyThreadState_New(autoInterpreterState); if (tcur == NULL)