Fixes for previous commit
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Tue, 12 May 2009 07:49:54 +0000 (09:49 +0200)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Tue, 12 May 2009 07:49:54 +0000 (09:49 +0200)
Cython/Compiler/Buffer.py
Cython/Compiler/Code.py
Cython/Compiler/ModuleNode.py

index 1fd04d620a64ad18f959ad85f772c114603f6d32..e19fb3fbcca8c50fd8bbc4d539260f401d251a4d 100644 (file)
@@ -618,7 +618,7 @@ def get_type_information_cname(code, dtype, maxdepth=None):
             # Must pre-call all used types in order not to recurse utility code
             # writing.
             assert len(fields) > 0
-            types = [get_type_information_cname(proto, f.type, maxdepth - 1)
+            types = [get_type_information_cname(code, f.type, maxdepth - 1)
                      for f in fields]
             typecode.putln("static __Pyx_StructField %s[] = {" % structinfo_name, safe=True)
             for f, typeinfo in zip(fields, types):
index 50255b5c344f1ec9f8056997c4e6ea8daac272ec..48fbbd01156736d85d0f8e4b62596525e0205102 100644 (file)
@@ -253,13 +253,13 @@ class GlobalState(object):
 
         assert writer.globalstate is None
         writer.globalstate = self
-        for part in self.code_layout:
-            self.parts[part] = writer.insertion_point()#new_writer()
+        self.rootwriter = writer
 
-        self.init_writers(writer)
-        
+    def initialize_main_c_code(self):
+        rootwriter = self.rootwriter
+        for part in self.code_layout:
+            self.parts[part] = rootwriter.insertion_point()
 
-    def init_writers(self, rootwriter):
         self.decls_writer = rootwriter.new_writer()
         self.pystring_table = rootwriter.new_writer()
         self.init_cached_builtins_writer = rootwriter.new_writer()
@@ -297,7 +297,7 @@ class GlobalState(object):
             (Naming.filetable_cname, Naming.filenames_cname))
         code.putln("}")
 
-    def finalize_writers(self):
+    def finalize_main_c_code(self):
         self.close_global_decls()
 
         #
index 499190e4d91aca84b8ee1609dd69277ee98e5f6a..af52468d6d5ca866f9e1ac9b9ab7053edd6bad74 100644 (file)
@@ -253,6 +253,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
             emit_linenums = options.emit_linenums
             rootwriter = Code.CCodeWriter(emit_linenums=emit_linenums)
         globalstate = Code.GlobalState(rootwriter, emit_linenums)
+        globalstate.initialize_main_c_code()
         h_code = globalstate['h_code']
         
         self.generate_module_preamble(env, modules, h_code)
@@ -294,7 +295,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
 
         for codetup, name in env.utility_code_list:
             globalstate.use_utility_code(codetup, name)
-        globalstate.finalize_writers()
+        globalstate.finalize_main_c_code()
         
         f = open_new_file(result.c_file)
         rootwriter.copyto(f)