Fix #258, extern builtin conflicts.
authorRobert Bradshaw <robertwb@math.washington.edu>
Fri, 27 Nov 2009 20:07:01 +0000 (12:07 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Fri, 27 Nov 2009 20:07:01 +0000 (12:07 -0800)
Cython/Compiler/ExprNodes.py
Cython/Compiler/PyrexTypes.py

index e4c9a4f331c100a65d6b4f263bf9d5a94ceb81ce..709d5a027fd8f8ff9bc3b9fe46871a85fe597e79 100644 (file)
@@ -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)
index 5c0c20d73329423bbe421b25abc6177eddbd4925..d187de4b676377768de1c4560846b7b5199f76a6 100644 (file)
@@ -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