Mercurial > cpython-lru_cache-weakref
diff Modules/_testembed.c @ 69585:79fcd71d0356
Fix compilation of _testembed.c without threads
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Tue, 26 Apr 2011 23:37:02 +0200 |
| parents | d195ff5c44f4 |
| children | 9cd88b39ef62 |
line wrap: on
line diff
--- a/Modules/_testembed.c Tue Apr 26 23:34:58 2011 +0200 +++ b/Modules/_testembed.c Tue Apr 26 23:37:02 2011 +0200 @@ -17,7 +17,9 @@ 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 @@ 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 @@ PyThreadState_Swap(mainstate); print_subinterp(); +#ifdef WITH_THREAD PyGILState_Release(gilstate); +#endif PyEval_RestoreThread(mainstate); Py_Finalize();
