diff options
author | Robert Bradshaw <robertwb@gmail.com> | 2017-06-29 15:49:57 -0700 |
---|---|---|
committer | Robert Bradshaw <robertwb@gmail.com> | 2017-06-29 15:49:57 -0700 |
commit | 30437c3f59fb16a7eb339eb603cf03229960d55e (patch) | |
tree | e66517d874e944a81e6b4b78728f814029d100f5 /Cython/Utility/ModuleSetupCode.c | |
parent | bc470e856af85ecbf52233d95406bd17a44c9b8c (diff) | |
download | cython-30437c3f59fb16a7eb339eb603cf03229960d55e.tar.gz |
Fixes for other Python versions.
Diffstat (limited to 'Cython/Utility/ModuleSetupCode.c')
-rw-r--r-- | Cython/Utility/ModuleSetupCode.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index d10aa3ffe..5b112d598 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -905,6 +905,18 @@ static void __Pyx_FastGilFuncInit(void); // To make optimal use of this thread local, we attempt to share it between // modules. + +#if PY_VERSION_HEX >= 0x03050000 + #define __Pyx_PyThreadState_Current _PyThreadState_FastGet() +#elif PY_VERSION_HEX >= 0x03000000 + #define __Pyx_PyThreadState_Current (PyThreadState*)_Py_atomic_load_relaxed(_PyThreadState_Current) +#elif PY_VERSION_HEX < 0x02070000 + #undef CYTHON_THREAD_LOCAL +#else + #define __Pyx_PyThreadState_Current _PyThreadState_Current +#endif + + #ifdef CYTHON_THREAD_LOCAL #include "pythread.h" @@ -933,7 +945,7 @@ PyGILState_STATE __Pyx_FastGil_PyGILState_Ensure(void) { // Uninitialized, need to initialize now. return PyGILState_Ensure(); } - current = tcur == _PyThreadState_Current; + current = tcur == __Pyx_PyThreadState_Current; if (current == 0) { PyEval_RestoreThread(tcur); } |