diff options
-rw-r--r-- | Misc/NEWS.d/next/C API/2019-08-23-11-35-55.bpo-37926.hnI5IQ.rst | 1 | ||||
-rw-r--r-- | Python/sysmodule.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/C API/2019-08-23-11-35-55.bpo-37926.hnI5IQ.rst b/Misc/NEWS.d/next/C API/2019-08-23-11-35-55.bpo-37926.hnI5IQ.rst new file mode 100644 index 0000000..2018533 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2019-08-23-11-35-55.bpo-37926.hnI5IQ.rst @@ -0,0 +1 @@ +Fix a crash in ``PySys_SetArgvEx(0, NULL, 0)``. diff --git a/Python/sysmodule.c b/Python/sysmodule.c index a89ebce..738bbc8 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -3058,11 +3058,11 @@ make_sys_argv(int argc, wchar_t * const * argv) void PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath) { + wchar_t* empty_argv[1] = {L""}; PyThreadState *tstate = _PyThreadState_GET(); if (argc < 1 || argv == NULL) { /* Ensure at least one (empty) argument is seen */ - wchar_t* empty_argv[1] = {L""}; argv = empty_argv; argc = 1; } |