summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2020-06-22 23:43:41 +0200
committerStefan Behnel <stefan_ml@behnel.de>2020-06-22 23:43:41 +0200
commit5492c4295ecb97d5d9468cc0fa4a870c32307e53 (patch)
tree8234076e6d554dcc6b3ad210c18e46c5b9152a8f
parent8f53112a95eb3328e58a3c47b5cd1119930358cd (diff)
downloadcython-5492c4295ecb97d5d9468cc0fa4a870c32307e53.tar.gz
Avoid a call to PyTuple_GET_ITEM() to get the item array pointer if CYTHON_ASSUME_SAFE_MACROS is disabled.
See https://github.com/cython/cython/issues/3701
-rw-r--r--Cython/Utility/CythonFunction.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Cython/Utility/CythonFunction.c b/Cython/Utility/CythonFunction.c
index 74aee2d49..8f4809694 100644
--- a/Cython/Utility/CythonFunction.c
+++ b/Cython/Utility/CythonFunction.c
@@ -652,7 +652,13 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P
// CPython would normally use vectorcall directly instead of tp_call.
__pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
if (vc) {
+#if CYTHON_ASSUME_SAFE_MACROS
return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), PyTuple_GET_SIZE(args), kw);
+#else
+ // avoid unused function warning
+ (void) &__Pyx_PyVectorcall_FastCallDict;
+ return PyVectorcall_Call(func, args, kw);
+#endif
}
#endif