def generate_base_type_import_code(self, env, entry, code):
base_type = entry.type.base_type
- if base_type and base_type.module_name != env.qualified_name:
+ if base_type and base_type.module_name != env.qualified_name \
+ and not base_type.is_builtin_type:
self.generate_type_import_code(env, base_type, self.pos, code)
def use_type_import_utility_code(self, env):
if base_class_entry:
if not base_class_entry.is_type:
error(self.pos, "'%s' is not a type name" % self.base_class_name)
- elif not base_class_entry.type.is_extension_type:
+ elif not base_class_entry.type.is_extension_type and \
+ not (base_class_entry.type.is_builtin_type and \
+ base_class_entry.type.objstruct_cname):
error(self.pos, "'%s' is not an extension type" % self.base_class_name)
elif not base_class_entry.type.is_complete():
error(self.pos, "Base class '%s' of type '%s' is incomplete" % (
base_type = None
module_name = '__builtin__'
+ # fields that let it look like an extension type
+ vtabslot_cname = None
+ vtabstruct_cname = None
+ vtabptr_cname = None
+ typedef_flag = True
+ is_external = True
+
def __init__(self, name, cname, objstruct_cname=None):
self.name = name
self.cname = cname
- self.typeptr_cname = "&" + cname
+ self.typeptr_cname = "(&%s)" % cname
self.objstruct_cname = objstruct_cname
def set_scope(self, scope):