Commit ec2a95df authored by Stefan Behnel's avatar Stefan Behnel

fix support for redeclaring builtin types as external extension types, add a...

fix support for redeclaring builtin types as external extension types, add a big FIXME to mark for eventual removal
parent ddba4f1e
...@@ -433,6 +433,11 @@ class BuiltinObjectType(PyObjectType): ...@@ -433,6 +433,11 @@ class BuiltinObjectType(PyObjectType):
if isinstance(src_type, BuiltinObjectType): if isinstance(src_type, BuiltinObjectType):
return src_type.name == self.name return src_type.name == self.name
elif src_type.is_extension_type: elif src_type.is_extension_type:
# FIXME: This is an ugly special case that we currently
# keep supporting. It allows users to specify builtin
# types as external extension types, while keeping them
# compatible with the real builtin types. We already
# generate a warning for it. Big TODO: remove!
return (src_type.module_name == '__builtin__' and return (src_type.module_name == '__builtin__' and
src_type.name == self.name) src_type.name == self.name)
else: else:
...@@ -553,6 +558,14 @@ class PyExtensionType(PyObjectType): ...@@ -553,6 +558,14 @@ class PyExtensionType(PyObjectType):
if isinstance(src_type, PyExtensionType): if isinstance(src_type, PyExtensionType):
if src_type.base_type is not None: if src_type.base_type is not None:
return self.assignable_from(src_type.base_type) return self.assignable_from(src_type.base_type)
if isinstance(src_type, BuiltinObjectType):
# FIXME: This is an ugly special case that we currently
# keep supporting. It allows users to specify builtin
# types as external extension types, while keeping them
# compatible with the real builtin types. We already
# generate a warning for it. Big TODO: remove!
return (self.module_name == '__builtin__' and
self.name == src_type.name)
return False return False
def declaration_code(self, entity_code, def declaration_code(self, entity_code,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment