Avoid extra function call for un-optimized __Pyx_PyDict_GetItem.
authorRobert Bradshaw <robertwb@math.washington.edu>
Wed, 24 Feb 2010 06:12:26 +0000 (22:12 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Wed, 24 Feb 2010 06:12:26 +0000 (22:12 -0800)
Cython/Compiler/ExprNodes.py

index 86520b168788d26a0876acc1ea28f8ffa357e226..1f0a687c70247390d39f73e005e45b2c660fa492 100755 (executable)
@@ -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])