summaryrefslogtreecommitdiffstats
path: root/Python/frozenmain.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-02-14 20:17:47 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-02-14 20:17:47 (GMT)
commitf80ccf27cba2d2842ec4b85dc73202534f46b526 (patch)
treebe7626069f9c7efd33c1ca194f8d46533eb0426f /Python/frozenmain.c
parent8dcc1a9f96489bbd741a18fc3581a4778bc62d3b (diff)
parent2476b98acfe303ecc3ed9b38107f75e05dab95c5 (diff)
downloadcpython-f80ccf27cba2d2842ec4b85dc73202534f46b526.zip
cpython-f80ccf27cba2d2842ec4b85dc73202534f46b526.tar.gz
cpython-f80ccf27cba2d2842ec4b85dc73202534f46b526.tar.bz2
merge 3.4 (#22633)
Diffstat (limited to 'Python/frozenmain.c')
-rw-r--r--Python/frozenmain.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/Python/frozenmain.c b/Python/frozenmain.c
index cb84ed5..de8bd35 100644
--- a/Python/frozenmain.c
+++ b/Python/frozenmain.c
@@ -24,11 +24,13 @@ Py_FrozenMain(int argc, char **argv)
/* 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 @@ Py_FrozenMain(int argc, char **argv)
#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();