1. Anthony Tuininga
  2. cx_Freeze

Commits

Anthony Tuininga  committed fa8e32a

Ensure that Py_Finalize() is called even when exceptions take place!

  • Participants
  • Parent commits bbae591
  • Branches default

Comments (0)

Files changed (3)

File source/bases/Console.c

View file
 #else
     const char *fileName;
 #endif
+    int status;
 
     // initialize Python
     Py_NoSiteFlag = 1;
 #endif
 
     // do the work
+    status = 0;
     if (ExecuteScript(fileName) < 0)
-        return 1;
-
+        status = 1;
     Py_Finalize();
-    return 0;
+    return status;
 }
 

File source/bases/ConsoleKeepPath.c

View file
 #else
     const char *fileName;
 #endif
+    int status;
 
     // initialize Python
 #if PY_MAJOR_VERSION >= 3
 #endif
 
     // do the work
+    status = 0;
     if (ExecuteScript(fileName) < 0)
-        return 1;
+        status = 1;
 
     Py_Finalize();
-    return 0;
+    return status;
 }
 

File source/bases/Win32GUI.c

View file
     int showFlag)                       // show flag
 {
     const char *fileName;
+    int status;
 
     // initialize Python
     Py_NoSiteFlag = 1;
     PySys_SetArgv(__argc, __argv);
 
     // do the work
+    status = 0;
     if (ExecuteScript(fileName) < 0)
-        return 1;
+        status = 1;
 
     // terminate Python
     Py_Finalize();
-    return 0;
+    return status;
 }