From: Robert Bradshaw Date: Fri, 27 Nov 2009 20:07:01 +0000 (-0800) Subject: Fix #258, extern builtin conflicts. X-Git-Tag: 0.12.1~114^2~1 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=80135d83610c7f85b8af9f54f1f820fbb3c1c733;p=cython.git Fix #258, extern builtin conflicts. --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index e4c9a4f3..709d5a02 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -917,7 +917,7 @@ class StringNode(PyConstNode): is_identifier = None def coerce_to(self, dst_type, env): - if dst_type is not py_object_type and dst_type is not str_type: + if dst_type is not py_object_type and not str_type.subtype_of(dst_type): # if dst_type is Builtin.bytes_type: # # special case: bytes = 'str literal' # return BytesNode(self.pos, value=self.value) diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 5c0c20d7..d187de4b 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -400,8 +400,11 @@ class BuiltinObjectType(PyObjectType): return src_type.name == self.name or ( src_type.name == self.alternative_name and src_type.name is not None) + elif src_type.is_extension_type: + return (src_type.module_name == '__builtin__' and + src_type.name == self.name) else: - return not src_type.is_extension_type + return True def typeobj_is_available(self): return True