From 06695a0ed00a041d25cd6b08cbf17e5757e420de Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 4 May 2009 21:22:33 +0200 Subject: [PATCH] fix embedding (cython-unstable allocates string constants at code-gen time) --- Cython/Compiler/ModuleNode.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 2b7413e3..0b7eb86b 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -55,8 +55,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): else: env.doc = self.doc env.directives = self.directives - if Options.embed: - self.__main__cname = env.intern_identifier(EncodedString("__main__")) self.body.analyse_declarations(env) def process_implementation(self, options, result): @@ -1808,10 +1806,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): Naming.builtins_cname, code.error_goto(self.pos))) if Options.embed: + __main__cname = code.globalstate.get_py_string_const( + EncodedString("__main__"), identifier=True) code.putln( 'if (__Pyx_SetAttrString(%s, "__name__", %s) < 0) %s;' % ( env.module_cname, - self.__main__cname, + __main__cname, code.error_goto(self.pos))) if Options.pre_import is not None: code.putln( -- 2.26.2