From: Lisandro Dalcin Date: Mon, 15 Mar 2010 21:37:30 +0000 (-0300) Subject: use unmangled objstruct cname for ctypedef public classes X-Git-Tag: 0.13.beta0~281 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dc7a4af6249ea204bebc0c5989726d56f201b8d9;p=cython.git use unmangled objstruct cname for ctypedef public classes --- diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 072e7153..a8227029 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -227,7 +227,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): h_code.putln("%s DL_IMPORT(PyTypeObject) %s;" % ( Naming.extern_c_macro, type.typeobj_cname)) - #self.generate_obj_struct_definition(type, h_code) def generate_cclass_include_code(self, type, i_code): i_code.putln("cdef extern class %s.%s:" % ( @@ -390,9 +389,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): elif type.is_enum: self.generate_enum_definition(entry, code) elif type.is_extension_type and entry not in vtabslot_entries: - self.generate_obj_struct_definition(type, code) + self.generate_objstruct_definition(type, code) for entry in vtabslot_list: - self.generate_obj_struct_definition(entry.type, code) + self.generate_objstruct_definition(entry.type, code) for entry in vtab_list: self.generate_typeobject_predeclaration(entry, code) self.generate_exttype_vtable_struct(entry, code) @@ -658,7 +657,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): elif type.is_enum: self.generate_enum_definition(entry, code) elif type.is_extension_type: - self.generate_obj_struct_definition(type, code) + self.generate_objstruct_definition(type, code) def generate_gcc33_hack(self, env, code): # Workaround for spurious warning generation in gcc 3.3 @@ -804,7 +803,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): type.vtabstruct_cname, type.vtabptr_cname)) - def generate_obj_struct_definition(self, type, code): + def generate_objstruct_definition(self, type, code): code.mark_pos(type.pos) # Generate object struct definition for an # extension type. @@ -1509,7 +1508,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): if type.typedef_flag: objstruct = type.objstruct_cname else: - #objstruct = "struct %s" % scope.parent_type.objstruct_cname objstruct = "struct %s" % type.objstruct_cname code.putln( "sizeof(%s), /*tp_basicsize*/" % diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index afbca581..3ef2eef9 100755 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -517,10 +517,10 @@ class PyExtensionType(PyObjectType): return self.base_declaration_code(self.name, entity_code) else: if self.typedef_flag: - base_format = "%s" + objstruct = self.objstruct_cname else: - base_format = "struct %s" - base = public_decl(base_format % self.objstruct_cname, dll_linkage) + objstruct = "struct %s" % self.objstruct_cname + base = public_decl(objstruct, dll_linkage) if deref: return "%s %s" % (base, entity_code) else: diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 49c58f1e..27123a56 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -948,7 +948,6 @@ class ModuleScope(Scope): if visibility != 'public': warning(pos, "ctypedef only valid for public and extern classes", 2) objtypedef_cname = objstruct_cname - objstruct_cname = None typedef_flag = 0 else: objtypedef_cname = None