summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2012-03-26 13:11:22 (GMT)
committerStefan Krah <skrah@bytereef.org>2012-03-26 13:11:22 (GMT)
commit16ecb9dea016434cfe613e9fe96b793aecc83fc8 (patch)
tree1fe4b49ac95bef01d39ffb59a20d1e754bc47606 /Modules
parentc067d6661f1c5fc772753a34946aa18829ad04c0 (diff)
parent0f6ce8d9dfaaeca036a085ef8de252efa8a2beea (diff)
downloadcpython-16ecb9dea016434cfe613e9fe96b793aecc83fc8.zip
cpython-16ecb9dea016434cfe613e9fe96b793aecc83fc8.tar.gz
cpython-16ecb9dea016434cfe613e9fe96b793aecc83fc8.tar.bz2
Issue #3367: Merge fix from 3.2.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/python.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/python.c b/Modules/python.c
index 935908a..cf9383f 100644
--- a/Modules/python.c
+++ b/Modules/python.c
@@ -22,9 +22,9 @@ extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size);
int
main(int argc, char **argv)
{
- wchar_t **argv_copy = (wchar_t **)PyMem_Malloc(sizeof(wchar_t*)*argc);
+ wchar_t **argv_copy = (wchar_t **)PyMem_Malloc(sizeof(wchar_t*)*(argc+1));
/* We need a second copies, as Python might modify the first one. */
- wchar_t **argv_copy2 = (wchar_t **)PyMem_Malloc(sizeof(wchar_t*)*argc);
+ wchar_t **argv_copy2 = (wchar_t **)PyMem_Malloc(sizeof(wchar_t*)*(argc+1));
int i, res;
char *oldloc;
/* 754 requires that FP exceptions run in "no stop" mode by default,
@@ -58,6 +58,8 @@ main(int argc, char **argv)
}
argv_copy2[i] = argv_copy[i];
}
+ argv_copy2[argc] = argv_copy[argc] = NULL;
+
setlocale(LC_ALL, oldloc);
free(oldloc);
res = Py_Main(argc, argv_copy);