summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2011-05-25 22:37:45 (GMT)
committerStefan Krah <skrah@bytereef.org>2011-05-25 22:37:45 (GMT)
commitf2c6db5faca7ff04bb4d269780b1dd625bc54606 (patch)
tree7ab54f249fe905f4ed0b9f4e846ddf89b22539d0
parent988512cfd7c896dd8b900d0f00cba05c4c807dc3 (diff)
downloadcpython-f2c6db5faca7ff04bb4d269780b1dd625bc54606.zip
cpython-f2c6db5faca7ff04bb4d269780b1dd625bc54606.tar.gz
cpython-f2c6db5faca7ff04bb4d269780b1dd625bc54606.tar.bz2
Issue #12090: backport 79fcd71d0356
-rw-r--r--Modules/_testembed.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_testembed.c b/Modules/_testembed.c
index 0df5ede..51b439f 100644
--- a/Modules/_testembed.c
+++ b/Modules/_testembed.c
@@ -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();