merged '--embed' fix from cython-devel
authorStefan Behnel <scoder@users.berlios.de>
Sun, 4 Oct 2009 10:22:39 +0000 (12:22 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sun, 4 Oct 2009 10:22:39 +0000 (12:22 +0200)
1  2 
Cython/Compiler/ExprNodes.py
Cython/Compiler/ModuleNode.py
Cython/Compiler/Nodes.py

Simple merge
index 655f0c8d05667d8de2532925d13e00cc5e5e6be8,5fc77ca53498455b23d90f39ef4ae029ee72cbfa..dd3161b7a6c3d9f868ebf2f1f1e4fec440e93bec
@@@ -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))
  
 -                self.__main__cname,
++        __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,
++                __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()",
Simple merge