From 80135d83610c7f85b8af9f54f1f820fbb3c1c733 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Fri, 27 Nov 2009 12:07:01 -0800 Subject: [PATCH] Fix #258, extern builtin conflicts. --- Cython/Compiler/ExprNodes.py | 2 +- Cython/Compiler/PyrexTypes.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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 -- 2.26.2