summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/main.c6
-rw-r--r--Modules/python.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/Modules/main.c b/Modules/main.c
index bbf695f..0c38fac 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -486,10 +486,12 @@ Py_Main(int argc, wchar_t **argv)
/* Use utf-8 on Mac OS X */
unicode = PyUnicode_FromString(p);
#else
- wchar_t *wchar = _Py_char2wchar(p);
+ wchar_t *wchar;
+ size_t len;
+ wchar = _Py_char2wchar(p, &len);
if (wchar == NULL)
continue;
- unicode = PyUnicode_FromWideChar(wchar, wcslen(wchar));
+ unicode = PyUnicode_FromWideChar(wchar, len);
PyMem_Free(wchar);
#endif
if (unicode == NULL)
diff --git a/Modules/python.c b/Modules/python.c
index 9a71cd0..47685a4 100644
--- a/Modules/python.c
+++ b/Modules/python.c
@@ -41,7 +41,7 @@ main(int argc, char **argv)
oldloc = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, "");
for (i = 0; i < argc; i++) {
- argv_copy[i] = _Py_char2wchar(argv[i]);
+ argv_copy[i] = _Py_char2wchar(argv[i], NULL);
if (!argv_copy[i])
return 1;
argv_copy2[i] = argv_copy[i];