options = CompilationOptions(default_options)
sources = []
while args:
- print args
if args[0].startswith("-"):
option = pop_arg()
if option in ("-V", "--version"):
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):
env.module_cname,
Naming.builtins_cname,
code.error_goto(self.pos)))
+ if Options.embed:
+ code.putln(
+ 'if (__Pyx_SetAttrString(%s, "__name__", %s) < 0) %s;' % (
+ env.module_cname,
+ self.__main__cname,
+ code.error_goto(self.pos)))
if Options.pre_import is not None:
code.putln(
'%s = PyImport_AddModule(__Pyx_NAMESTR("%s"));' % (
#else
PyInit_%(module_name)s(name);
#endif
- r = PyErr_Occurred();
+ r = PyErr_Occurred() != NULL;
Py_Finalize();
return r;
}