]> granicus.if.org Git - python/commitdiff
Issue #12090: backport 79fcd71d0356
authorStefan Krah <skrah@bytereef.org>
Wed, 25 May 2011 22:37:45 +0000 (00:37 +0200)
committerStefan Krah <skrah@bytereef.org>
Wed, 25 May 2011 22:37:45 +0000 (00:37 +0200)
Modules/_testembed.c

index 0df5ede6e4bfaf7b29a02be415f8c4fb52cfb659..51b439f4804e65af0e44c30872aab23b16224a4e 100644 (file)
@@ -17,7 +17,9 @@ void print_subinterp(void)
 int main(int argc, char *argv[])
 {
     PyThreadState *mainstate, *substate;
+#ifdef WITH_THREAD
     PyGILState_STATE gilstate;
+#endif
     int i, j;
 
     for (i=0; i<3; i++) {
@@ -28,10 +30,12 @@ int main(int argc, char *argv[])
         Py_Initialize();
         mainstate = PyThreadState_Get();
 
+#ifdef WITH_THREAD
         PyEval_InitThreads();
         PyEval_ReleaseThread(mainstate);
 
         gilstate = PyGILState_Ensure();
+#endif
         print_subinterp();
         PyThreadState_Swap(NULL);
 
@@ -43,7 +47,9 @@ int main(int argc, char *argv[])
 
         PyThreadState_Swap(mainstate);
         print_subinterp();
+#ifdef WITH_THREAD
         PyGILState_Release(gilstate);
+#endif
 
         PyEval_RestoreThread(mainstate);
         Py_Finalize();