diff options
Diffstat (limited to 'Lib/python/pythreads.swg')
-rw-r--r-- | Lib/python/pythreads.swg | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/python/pythreads.swg b/Lib/python/pythreads.swg index d8797e659..96a64710c 100644 --- a/Lib/python/pythreads.swg +++ b/Lib/python/pythreads.swg @@ -8,8 +8,12 @@ # define SWIG_PYTHON_USE_GIL # endif # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ -# ifndef SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) +# if PY_VERSION_HEX < 0x03070000 +# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# else +# define SWIG_PYTHON_INITIALIZE_THREADS +# endif # endif # ifdef __cplusplus /* C++ code */ class SWIG_Python_Thread_Block { @@ -24,7 +28,7 @@ bool status; PyThreadState *save; public: - void end() { if (status) { PyEval_RestoreThread(save); status = false; }} + void end() { if (status) { status = false; PyEval_RestoreThread(save); }} SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} ~SWIG_Python_Thread_Allow() { end(); } }; |