From d334a832f0dd3562119f97f0a8d27917ac99d894 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Tue, 23 Feb 2010 22:12:26 -0800 Subject: [PATCH] Avoid extra function call for un-optimized __Pyx_PyDict_GetItem. --- Cython/Compiler/ExprNodes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 86520b16..1f0a687c 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -6494,13 +6494,13 @@ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { getitem_dict_utility_code = UtilityCode( proto = """ +#if PY_MAJOR_VERSION >= 3 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; if (unlikely(d == Py_None)) { __Pyx_RaiseNoneIndexingError(); return NULL; } -#if PY_MAJOR_VERSION >= 3 value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (!PyErr_Occurred()) @@ -6508,11 +6508,11 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { return NULL; } Py_INCREF(value); -#else - value = PyObject_GetItem(d, key); -#endif return value; } +#else + #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#endif """, requires = [raise_noneindex_error_utility_code]) -- 2.26.2