use unmangled objstruct cname for ctypedef public classes
authorLisandro Dalcin <dalcinl@gmail.com>
Mon, 15 Mar 2010 21:37:30 +0000 (18:37 -0300)
committerLisandro Dalcin <dalcinl@gmail.com>
Mon, 15 Mar 2010 21:37:30 +0000 (18:37 -0300)
Cython/Compiler/ModuleNode.py
Cython/Compiler/PyrexTypes.py
Cython/Compiler/Symtab.py

index 072e7153486e7c3587ed12abbbafb0213d48eaa8..a8227029da22d4de2ea13e4f3591aa7f162c83d0 100644 (file)
@@ -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*/" %
index afbca5817eff0e3c4b327232b7297faf5c896ce2..3ef2eef9e7e9fa18f77baf4ddf2d50d05634d7e3 100755 (executable)
@@ -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:
index 49c58f1e2a8f0816d6b6ce8934e71194d4e626b4..27123a56662fe65a0d8551a106010cd7c72c1ff0 100644 (file)
@@ -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