Commit 2cb860f2 authored by Lisandro Dalcin's avatar Lisandro Dalcin

fixes and cleanups in __Pyx_main()

parent 0c87bea0
...@@ -2664,8 +2664,6 @@ int %(wmain_method)s(int argc, wchar_t **argv) { ...@@ -2664,8 +2664,6 @@ int %(wmain_method)s(int argc, wchar_t **argv) {
#else #else
static int __Pyx_main(int argc, wchar_t **argv) { static int __Pyx_main(int argc, wchar_t **argv) {
#endif #endif
int r = 0;
PyObject* m = NULL;
/* 754 requires that FP exceptions run in "no stop" mode by default, /* 754 requires that FP exceptions run in "no stop" mode by default,
* and until C vendors implement C99's ways to control FP exceptions, * and until C vendors implement C99's ways to control FP exceptions,
* Python requires non-stop mode. Alas, some platforms enable FP * Python requires non-stop mode. Alas, some platforms enable FP
...@@ -2677,29 +2675,29 @@ static int __Pyx_main(int argc, wchar_t **argv) { ...@@ -2677,29 +2675,29 @@ static int __Pyx_main(int argc, wchar_t **argv) {
m = fpgetmask(); m = fpgetmask();
fpsetmask(m & ~FP_X_OFL); fpsetmask(m & ~FP_X_OFL);
#endif #endif
if (argc) { if (argc && argv)
Py_SetProgramName(argv[0]); Py_SetProgramName(argv[0]);
}
Py_Initialize(); Py_Initialize();
if (argc) {
PySys_SetArgv(argc, argv); PySys_SetArgv(argc, argv);
} { /* init module '%(module_name)s' as '__main__' */
PyObject* m = NULL;
%(module_is_main)s = 1; %(module_is_main)s = 1;
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
init%(module_name)s(); init%(module_name)s();
#else #else
m = PyInit_%(module_name)s(); m = PyInit_%(module_name)s();
#endif #endif
if (PyErr_Occurred() != NULL) { if (PyErr_Occurred()) {
r = 1;
PyErr_Print(); /* This exits with the right code if SystemExit. */ PyErr_Print(); /* This exits with the right code if SystemExit. */
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
if (Py_FlushLine()) PyErr_Clear(); if (Py_FlushLine()) PyErr_Clear();
#endif #endif
return 1;
} }
Py_XDECREF(m); Py_XDECREF(m);
}
Py_Finalize(); Py_Finalize();
return r; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment