From 42da74050349c2529aaa5c27678bbb6fd7c99ff5 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 3 Dec 2009 13:48:49 +0100 Subject: [PATCH] emulate original error for attributes on unconvertible types --- Cython/Compiler/ExprNodes.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 5b37aee0..db34be5c 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -3012,8 +3012,13 @@ class AttributeNode(ExprNode): self.member = self.attribute self.type = py_object_type self.is_py_attr = 1 - if not obj_type.is_pyobject: - self.obj = self.obj.coerce_to_pyobject(env) + if not obj_type.is_pyobject and not obj_type.is_error: + if obj_type.create_to_py_utility_code(env): + self.obj = self.obj.coerce_to_pyobject(env) + else: + error(self.pos, + "Object of type '%s' has no attribute '%s'" % + (obj_type, self.attribute)) def nogil_check(self, env): if self.is_py_attr: -- 2.26.2