From: Stefan Behnel Date: Mon, 4 May 2009 19:22:33 +0000 (+0200) Subject: fix embedding (cython-unstable allocates string constants at code-gen time) X-Git-Tag: 0.12.alpha0~304 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=06695a0ed00a041d25cd6b08cbf17e5757e420de;p=cython.git fix embedding (cython-unstable allocates string constants at code-gen time) --- 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(