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)
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