Commit a656e097 authored by Stefan Behnel's avatar Stefan Behnel

Avoid depending on CPython micro level versions at compile time. Compiling...

Avoid depending on CPython micro level versions at compile time. Compiling against 3.5.2 does not guarantee that we never get imported on 3.5.1.
Closes #1880.
parent 4c1cbef7
...@@ -1893,7 +1893,8 @@ _module._COROUTINE_TYPES = coro_types ...@@ -1893,7 +1893,8 @@ _module._COROUTINE_TYPES = coro_types
); );
} else { } else {
PyErr_Clear(); PyErr_Clear();
#if PY_VERSION_HEX < 0x03040200 // Always enable fallback: even if we compile against 3.4.2, we might be running on 3.4.1 at some point.
//#if PY_VERSION_HEX < 0x03040200
// Py3.4.1 used to have asyncio.tasks instead of asyncio.coroutines // Py3.4.1 used to have asyncio.tasks instead of asyncio.coroutines
package = __Pyx_Import(PYIDENT("asyncio.tasks"), NULL, 0); package = __Pyx_Import(PYIDENT("asyncio.tasks"), NULL, 0);
if (unlikely(!package)) goto asyncio_done; if (unlikely(!package)) goto asyncio_done;
...@@ -1914,15 +1915,15 @@ if hasattr(_module, 'iscoroutine'): ...@@ -1914,15 +1915,15 @@ if hasattr(_module, 'iscoroutine'):
old_types.add(_cython_generator_type) old_types.add(_cython_generator_type)
""") """)
); );
#endif //#endif
// Py < 0x03040200 // Py < 0x03040200
} }
Py_DECREF(package); Py_DECREF(package);
if (unlikely(!patch_module)) goto ignore; if (unlikely(!patch_module)) goto ignore;
#if PY_VERSION_HEX < 0x03040200 //#if PY_VERSION_HEX < 0x03040200
asyncio_done: asyncio_done:
PyErr_Clear(); PyErr_Clear();
#endif //#endif
asyncio_patched = 1; asyncio_patched = 1;
#ifdef __Pyx_Generator_USED #ifdef __Pyx_Generator_USED
// now patch inspect.isgenerator() by looking up the imported module in the patched asyncio module // now patch inspect.isgenerator() by looking up the imported module in the patched asyncio module
......
...@@ -12,14 +12,15 @@ ...@@ -12,14 +12,15 @@
#if CYTHON_FAST_THREAD_STATE #if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare PyThreadState *$local_tstate_cname; #define __Pyx_PyThreadState_declare PyThreadState *$local_tstate_cname;
#define __Pyx_PyErr_Occurred() $local_tstate_cname->curexc_type #define __Pyx_PyErr_Occurred() $local_tstate_cname->curexc_type
#if PY_VERSION_HEX >= 0x03050000 #if PY_VERSION_HEX >= 0x03060000
// Actually added in 3.5.2, but compiling against that does not guarantee that we get imported there.
#define __Pyx_PyThreadState_assign $local_tstate_cname = _PyThreadState_UncheckedGet(); #define __Pyx_PyThreadState_assign $local_tstate_cname = _PyThreadState_UncheckedGet();
#elif PY_VERSION_HEX >= 0x03000000 #elif PY_VERSION_HEX >= 0x03000000
#define __Pyx_PyThreadState_assign $local_tstate_cname = PyThreadState_Get(); #define __Pyx_PyThreadState_assign $local_tstate_cname = PyThreadState_GET();
#elif PY_VERSION_HEX >= 0x02070000 #elif PY_VERSION_HEX >= 0x02070000
#define __Pyx_PyThreadState_assign $local_tstate_cname = _PyThreadState_Current; #define __Pyx_PyThreadState_assign $local_tstate_cname = _PyThreadState_Current;
#else #else
#define __Pyx_PyThreadState_assign $local_tstate_cname = PyThreadState_Get(); #define __Pyx_PyThreadState_assign $local_tstate_cname = PyThreadState_GET();
#endif #endif
#else #else
#define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_declare
......
...@@ -247,10 +247,11 @@ ...@@ -247,10 +247,11 @@
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
#define __Pyx_PyThreadState_Current PyThreadState_GET() #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03050200 #if PY_VERSION_HEX >= 0x03060000
//#elif PY_VERSION_HEX >= 0x03050200
#define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000 #elif PY_VERSION_HEX >= 0x03000000
#define __Pyx_PyThreadState_Current PyThreadState_Get() #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else #else
#define __Pyx_PyThreadState_Current _PyThreadState_Current #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif #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