summaryrefslogtreecommitdiffstats
path: root/Modules/_testembed.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-04-26 21:37:02 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-04-26 21:37:02 (GMT)
commit66299a49f0f5b3aab6ceed6cbdf94a6b89b70328 (patch)
tree9fef9ec3295ba837b823b081d5daab839f046ae8 /Modules/_testembed.c
parent8e4d4078183bfb262db3d8a5a5b26dbc79f56109 (diff)
downloadcpython-66299a49f0f5b3aab6ceed6cbdf94a6b89b70328.zip
cpython-66299a49f0f5b3aab6ceed6cbdf94a6b89b70328.tar.gz
cpython-66299a49f0f5b3aab6ceed6cbdf94a6b89b70328.tar.bz2
Fix compilation of _testembed.c without threads
Diffstat (limited to 'Modules/_testembed.c')
-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();