Commit 1fa613d5 authored by Stefan Behnel's avatar Stefan Behnel

Disable "fast_gil" support in Py3<3.6 since Py3<3.5.2 lacks...

Disable "fast_gil" support in Py3<3.6 since Py3<3.5.2 lacks _PyThreadState_UncheckedGet() and crashes when calling PyThreadState_GET() without a thread state.
parent 95bf3e76
...@@ -71,6 +71,8 @@ ...@@ -71,6 +71,8 @@
#define CYTHON_UNPACK_METHODS 0 #define CYTHON_UNPACK_METHODS 0
#undef CYTHON_FAST_THREAD_STATE #undef CYTHON_FAST_THREAD_STATE
#define CYTHON_FAST_THREAD_STATE 0 #define CYTHON_FAST_THREAD_STATE 0
#undef CYTHON_FAST_GIL
#define CYTHON_FAST_GIL 0
#undef CYTHON_FAST_PYCALL #undef CYTHON_FAST_PYCALL
#define CYTHON_FAST_PYCALL 0 #define CYTHON_FAST_PYCALL 0
#undef CYTHON_PEP489_MULTI_PHASE_INIT #undef CYTHON_PEP489_MULTI_PHASE_INIT
...@@ -114,6 +116,8 @@ ...@@ -114,6 +116,8 @@
#endif #endif
#undef CYTHON_FAST_THREAD_STATE #undef CYTHON_FAST_THREAD_STATE
#define CYTHON_FAST_THREAD_STATE 0 #define CYTHON_FAST_THREAD_STATE 0
#undef CYTHON_FAST_GIL
#define CYTHON_FAST_GIL 0
#undef CYTHON_FAST_PYCALL #undef CYTHON_FAST_PYCALL
#define CYTHON_FAST_PYCALL 0 #define CYTHON_FAST_PYCALL 0
#undef CYTHON_PEP489_MULTI_PHASE_INIT #undef CYTHON_PEP489_MULTI_PHASE_INIT
...@@ -169,6 +173,10 @@ ...@@ -169,6 +173,10 @@
#ifndef CYTHON_FAST_THREAD_STATE #ifndef CYTHON_FAST_THREAD_STATE
#define CYTHON_FAST_THREAD_STATE 1 #define CYTHON_FAST_THREAD_STATE 1
#endif #endif
#ifndef CYTHON_FAST_GIL
// Py3<3.5.2 does not support _PyThreadState_UncheckedGet().
#define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000)
#endif
#ifndef CYTHON_FAST_PYCALL #ifndef CYTHON_FAST_PYCALL
#define CYTHON_FAST_PYCALL 1 #define CYTHON_FAST_PYCALL 1
#endif #endif
...@@ -1339,6 +1347,8 @@ __Pyx_FastGilFuncInit(); ...@@ -1339,6 +1347,8 @@ __Pyx_FastGilFuncInit();
/////////////// FastGil.proto /////////////// /////////////// FastGil.proto ///////////////
//@proto_block: utility_code_proto_before_types //@proto_block: utility_code_proto_before_types
#if CYTHON_FAST_GIL
struct __Pyx_FastGilVtab { struct __Pyx_FastGilVtab {
PyGILState_STATE (*Fast_PyGILState_Ensure)(void); PyGILState_STATE (*Fast_PyGILState_Ensure)(void);
void (*Fast_PyGILState_Release)(PyGILState_STATE oldstate); void (*Fast_PyGILState_Release)(PyGILState_STATE oldstate);
...@@ -1373,6 +1383,14 @@ static void __Pyx_FastGilFuncInit(void); ...@@ -1373,6 +1383,14 @@ static void __Pyx_FastGilFuncInit(void);
#endif #endif
#endif #endif
#else
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()
#endif
/////////////// FastGil /////////////// /////////////// FastGil ///////////////
//@requires: CommonStructures.c::FetchCommonPointer //@requires: CommonStructures.c::FetchCommonPointer
// The implementations of PyGILState_Ensure/Release calls PyThread_get_key_value // The implementations of PyGILState_Ensure/Release calls PyThread_get_key_value
...@@ -1382,6 +1400,8 @@ static void __Pyx_FastGilFuncInit(void); ...@@ -1382,6 +1400,8 @@ static void __Pyx_FastGilFuncInit(void);
// To make optimal use of this thread local, we attempt to share it between // To make optimal use of this thread local, we attempt to share it between
// modules. // modules.
#if CYTHON_FAST_GIL
#define __Pyx_FastGIL_ABI_module "_cython_" CYTHON_ABI #define __Pyx_FastGIL_ABI_module "_cython_" CYTHON_ABI
#define __Pyx_FastGIL_PyCapsuleName "FastGilFuncs" #define __Pyx_FastGIL_PyCapsuleName "FastGilFuncs"
#define __Pyx_FastGIL_PyCapsule \ #define __Pyx_FastGIL_PyCapsule \
...@@ -1487,3 +1507,5 @@ static void __Pyx_FastGilFuncInit(void) { ...@@ -1487,3 +1507,5 @@ static void __Pyx_FastGilFuncInit(void) {
__Pyx_FastGilFuncInit0(); __Pyx_FastGilFuncInit0();
} }
} }
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment