From ec3ee6808dea6f8ecc1bfb0f067cd238b73d6d5f Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 3 Dec 2009 13:17:39 +0100 Subject: [PATCH] enable Python methods on C types through coercion to Python objects --- Cython/Compiler/ExprNodes.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 21b3bf1c..588b379c 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -3010,14 +3010,14 @@ class AttributeNode(ExprNode): if obj_type is None: obj_type = self.obj.type self.member = self.attribute - if obj_type.is_pyobject: - self.type = py_object_type - self.is_py_attr = 1 - else: - if not obj_type.is_error: - error(self.pos, - "Object of type '%s' has no attribute '%s'" % - (obj_type, 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_error: + ## 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