speed up lookup of Python object attributes a little
authorStefan Behnel <stefan_ml@behnel.de>
Thu, 7 Mar 2013 21:00:01 +0000 (22:00 +0100)
committerStefan Behnel <stefan_ml@behnel.de>
Thu, 7 Mar 2013 21:00:01 +0000 (22:00 +0100)
Cython/Compiler/ExprNodes.py

index 42e1293..05fee43 100755 (executable)
@@ -5131,8 +5131,10 @@ class AttributeNode(ExprNode):
 
     def generate_result_code(self, code):
         if self.is_py_attr:
+            code.globalstate.use_utility_code(
+                UtilityCode.load_cached("PyObjectGetAttrStr", "ObjectHandling.c"))
             code.putln(
-                '%s = PyObject_GetAttr(%s, %s); %s' % (
+                '%s = __Pyx_PyObject_GetAttrStr(%s, %s); %s' % (
                     self.result(),
                     self.obj.py_result(),
                     code.intern_identifier(self.attribute),