From: Robert Bradshaw Date: Wed, 24 Feb 2010 06:12:26 +0000 (-0800) Subject: Avoid extra function call for un-optimized __Pyx_PyDict_GetItem. X-Git-Tag: 0.13.beta0~319^2~15 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d334a832f0dd3562119f97f0a8d27917ac99d894;p=cython.git Avoid extra function call for un-optimized __Pyx_PyDict_GetItem. --- 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])