From 253a9f349ac7bfbf6735b39d5cc31a8d472be8a5 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 24 Aug 2012 07:25:25 +0200 Subject: [PATCH] fix attribute access on optimised builtin functions --- Cython/Compiler/ExprNodes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 48da0df..46942c1 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -4648,6 +4648,11 @@ class AttributeNode(ExprNode): if not obj_type.is_pyobject and not obj_type.is_error: if obj_type.can_coerce_to_pyobject(env): self.obj = self.obj.coerce_to_pyobject(env) + elif (obj_type.is_cfunction and self.obj.is_name + and self.obj.entry.as_variable + and self.obj.entry.as_variable.type.is_pyobject): + # might be an optimised builtin function => unpack it + self.obj = self.obj.coerce_to_pyobject(env) else: error(self.pos, "Object of type '%s' has no attribute '%s'" % -- 2.7.4