cython-devel

changeset 2715:56bc793d18e0

enable Python methods on C types through coercion to Python objects
author Stefan Behnel <scoder@users.berlios.de>
date Thu Dec 03 13:17:39 2009 +0100 (2 years ago)
parents 6f33a50e3ade
children 609f2037a6b6
files Cython/Compiler/ExprNodes.py
line diff
1.1 --- a/Cython/Compiler/ExprNodes.py Sat Nov 28 14:23:04 2009 +0100 1.2 +++ b/Cython/Compiler/ExprNodes.py Thu Dec 03 13:17:39 2009 +0100 1.3 @@ -3010,14 +3010,14 @@ 1.4 if obj_type is None: 1.5 obj_type = self.obj.type 1.6 self.member = self.attribute 1.7 - if obj_type.is_pyobject: 1.8 - self.type = py_object_type 1.9 - self.is_py_attr = 1 1.10 - else: 1.11 - if not obj_type.is_error: 1.12 - error(self.pos, 1.13 - "Object of type '%s' has no attribute '%s'" % 1.14 - (obj_type, self.attribute)) 1.15 + self.type = py_object_type 1.16 + self.is_py_attr = 1 1.17 + if not obj_type.is_pyobject: 1.18 + self.obj = self.obj.coerce_to_pyobject(env) 1.19 + ## if not obj_type.is_error: 1.20 + ## error(self.pos, 1.21 + ## "Object of type '%s' has no attribute '%s'" % 1.22 + ## (obj_type, self.attribute)) 1.23 1.24 def nogil_check(self, env): 1.25 if self.is_py_attr: