From ace659a6e527e0c7d06d886a6476a2e242f0afcd Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 7 Mar 2013 22:00:01 +0100 Subject: [PATCH] speed up lookup of Python object attributes a little --- Cython/Compiler/ExprNodes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 42e1293..05fee43 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -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), -- 2.7.4