From 936fa570f30242bac80885a157d9f59354cae3cc Mon Sep 17 00:00:00 2001 From: Thomas Hunger Date: Wed, 19 Sep 2007 12:47:06 +0200 Subject: [PATCH] Emit and release temporary variables in global namespace because the class-body code is exectuted at module-init time. --- Cython/Compiler/ModuleNode.py | 2 +- Cython/Compiler/Symtab.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index c52bede4..428110c3 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -995,7 +995,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): "static struct PyMethodDef %s[] = {" % env.method_table_cname) for entry in env.pyfunc_entries: - code.put_pymethoddef(entry, ",") + code.put_pymethoddef(entry, ",") code.putln( "{0, 0, 0, 0}") code.putln( diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index b25b9154..2f0c0c3e 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -1186,7 +1186,13 @@ class CClassScope(ClassScope): adapt(base_entry.cname), base_entry.visibility) entry.is_inherited = 1 + def allocate_temp(self, type): + return Scope.allocate_temp(self.global_scope(), type) + def release_temp(self, cname): + return Scope.release_temp(self.global_scope(), cname) + + class PropertyScope(Scope): # Scope holding the __get__, __set__ and __del__ methods for # a property of an extension type. -- 2.26.2