[Python-checkins] cpython (merge 3.4 -> default): merge 3.4 (#22633)

benjamin.peterson python-checkins at python.org
Sat Feb 14 21:17:52 CET 2015


https://hg.python.org/cpython/rev/ba2da33d2654
changeset:   94613:ba2da33d2654
parent:      94610:a2217106ca5e
parent:      94611:d0b6efed4766
user:        Benjamin Peterson <benjamin at python.org>
date:        Sat Feb 14 15:17:47 2015 -0500
summary:
  merge 3.4 (#22633)

files:
  Python/frozenmain.c |  15 +++++++++------
  1 files changed, 9 insertions(+), 6 deletions(-)


diff --git a/Python/frozenmain.c b/Python/frozenmain.c
--- a/Python/frozenmain.c
+++ b/Python/frozenmain.c
@@ -24,11 +24,13 @@
     /* We need a second copies, as Python might modify the first one. */
     wchar_t **argv_copy2 = NULL;
 
-    argv_copy = PyMem_RawMalloc(sizeof(wchar_t*) * argc);
-    argv_copy2 = PyMem_RawMalloc(sizeof(wchar_t*) * argc);
-    if (!argv_copy || !argv_copy2) {
-        fprintf(stderr, "out of memory\n");
-        goto error;
+    if (argc > 0) {
+        argv_copy = PyMem_RawMalloc(sizeof(wchar_t*) * argc);
+        argv_copy2 = PyMem_RawMalloc(sizeof(wchar_t*) * argc);
+        if (!argv_copy || !argv_copy2) {
+            fprintf(stderr, "out of memory\n");
+            goto error;
+        }
     }
 
     Py_FrozenFlag = 1; /* Suppress errors from getpath.c */
@@ -68,7 +70,8 @@
 #ifdef MS_WINDOWS
     PyInitFrozenExtensions();
 #endif /* MS_WINDOWS */
-    Py_SetProgramName(argv_copy[0]);
+    if (argc >= 1)
+        Py_SetProgramName(argv_copy[0]);
     Py_Initialize();
 #ifdef MS_WINDOWS
     PyWinFreeze_ExeInit();

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list