diff --git a/Cython/Utility/Coroutine.c b/Cython/Utility/Coroutine.c index fe268da4e229a2a29ed0b30d938413768b81d4b5..bf4064406d2224003c8a58677f20a941617e921e 100644 --- a/Cython/Utility/Coroutine.c +++ b/Cython/Utility/Coroutine.c @@ -783,12 +783,14 @@ static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { ret = __Pyx_async_gen_asend_send(yf, value); } else #endif - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (!defined(_MSC_VER) || PY_VERSION_HEX >= 0x03060000) + // _PyGen_Send() is not exported before Py3.6 if (PyGen_CheckExact(yf)) { ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); } else #endif - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (!defined(_MSC_VER) || PY_VERSION_HEX >= 0x03060000) + // _PyGen_Send() is not exported before Py3.6 if (PyCoro_CheckExact(yf)) { ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); } else @@ -883,7 +885,8 @@ static PyObject *__Pyx_Generator_Next(PyObject *self) { ret = __Pyx_Generator_Next(yf); } else #endif - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (!defined(_MSC_VER) || PY_VERSION_HEX >= 0x03060000) + // _PyGen_Send() is not exported before Py3.6 if (PyGen_CheckExact(yf)) { ret = _PyGen_Send((PyGenObject*)yf, NULL); } else