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 @@
#define CYTHON_UNPACK_METHODS 0
#undef CYTHON_FAST_THREAD_STATE
#define CYTHON_FAST_THREAD_STATE 0
#undef CYTHON_FAST_GIL
#define CYTHON_FAST_GIL 0
#undef CYTHON_FAST_PYCALL
#define CYTHON_FAST_PYCALL 0
#undef CYTHON_PEP489_MULTI_PHASE_INIT
......@@ -114,6 +116,8 @@
#endif
#undef CYTHON_FAST_THREAD_STATE
#define CYTHON_FAST_THREAD_STATE 0
#undef CYTHON_FAST_GIL
#define CYTHON_FAST_GIL 0
#undef CYTHON_FAST_PYCALL
#define CYTHON_FAST_PYCALL 0
#undef CYTHON_PEP489_MULTI_PHASE_INIT
......@@ -169,6 +173,10 @@
#ifndef CYTHON_FAST_THREAD_STATE
#define CYTHON_FAST_THREAD_STATE 1
#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
#define CYTHON_FAST_PYCALL 1
#endif
......@@ -1339,6 +1347,8 @@ __Pyx_FastGilFuncInit();
/////////////// FastGil.proto ///////////////
//@proto_block: utility_code_proto_before_types
#if CYTHON_FAST_GIL
struct __Pyx_FastGilVtab {
PyGILState_STATE (*Fast_PyGILState_Ensure)(void);
void (*Fast_PyGILState_Release)(PyGILState_STATE oldstate);
......@@ -1373,6 +1383,14 @@ static void __Pyx_FastGilFuncInit(void);
#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 ///////////////
//@requires: CommonStructures.c::FetchCommonPointer
// The implementations of PyGILState_Ensure/Release calls PyThread_get_key_value
......@@ -1382,6 +1400,8 @@ static void __Pyx_FastGilFuncInit(void);
// To make optimal use of this thread local, we attempt to share it between
// modules.
#if CYTHON_FAST_GIL
#define __Pyx_FastGIL_ABI_module "_cython_" CYTHON_ABI
#define __Pyx_FastGIL_PyCapsuleName "FastGilFuncs"
#define __Pyx_FastGIL_PyCapsule \
......@@ -1487,3 +1507,5 @@ static void __Pyx_FastGilFuncInit(void) {
__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