diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2017-06-05 09:45:06 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2017-07-09 14:50:46 +0200 |
commit | 84d6bd15210f7baa7daeca61b5c714faeb35a5c9 (patch) | |
tree | 9fce2451903eb0ce877e881675e7c9676543cc7a /Cython/Utility/ModuleSetupCode.c | |
parent | a4fb856ace9c8be3ab84f2ae3b5c697d877f562f (diff) | |
download | cython-84d6bd15210f7baa7daeca61b5c714faeb35a5c9.tar.gz |
adapt METH_FASTCALL handling to signature change of _PyCFunctionFast() in Py3.7
Diffstat (limited to 'Cython/Utility/ModuleSetupCode.c')
-rw-r--r-- | Cython/Utility/ModuleSetupCode.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index f8c7760cf..69ab010bd 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -196,17 +196,22 @@ #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif -#ifndef METH_FASTCALL - // new in CPython 3.6 - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); +#if PY_VERSION_HEX < 0x030700A0 || !defined(METH_FASTCALL) + // new in CPython 3.6, but changed in 3.7 + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs); + // new in CPython 3.7, used to be old signature of _PyCFunctionFast() in 3.6 + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject **args, + Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast + #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func) \ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif |