From: Stefan Behnel Date: Sun, 4 Oct 2009 10:22:39 +0000 (+0200) Subject: merged '--embed' fix from cython-devel X-Git-Tag: 0.12.alpha0~182^2~11 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=63c226f8d3dfda1a6be8b5db3943f2795e7da72f;p=cython.git merged '--embed' fix from cython-devel --- 63c226f8d3dfda1a6be8b5db3943f2795e7da72f diff --cc Cython/Compiler/ModuleNode.py index 655f0c8d,5fc77ca5..dd3161b7 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@@ -1668,6 -1678,14 +1668,16 @@@ class ModuleNode(Nodes.Node, Nodes.Bloc code.putln("/*--- Initialize various global constants etc. ---*/") code.putln(code.error_goto_if_neg("__Pyx_InitGlobals()", self.pos)) ++ __main__name = code.globalstate.get_py_string_const( ++ EncodedString("__main__"), identifier=True) + code.putln("if (%s%s) {" % (Naming.module_is_main, self.full_module_name.replace('.', '__'))) + code.putln( + 'if (__Pyx_SetAttrString(%s, "__name__", %s) < 0) %s;' % ( + env.module_cname, - self.__main__cname, ++ __main__name.cname, + code.error_goto(self.pos))) + code.putln("}") + if Options.cache_builtins: code.putln("/*--- Builtin init code ---*/") code.putln(code.error_goto_if_neg("__Pyx_InitCachedBuiltins()",