Mercurial > cpython-lru_cache-weakref
diff Modules/python.c @ 65277:49df778889e6
Revert r85435 (and r85440): decode command line arguments from utf-8
Python exits with a fatal error if the command line contains an undecodable
argument. PyUnicode_FromString() fails at the first undecodable byte because it
calls the error handler, but error handlers are not ready before Python
initialization.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Wed, 13 Oct 2010 23:24:06 +0000 |
| parents | e9ea09787a35 |
| children | 3794c9b50824 |
line wrap: on
line diff
--- a/Modules/python.c Wed Oct 13 22:54:34 2010 +0000 +++ b/Modules/python.c Wed Oct 13 23:24:06 2010 +0000 @@ -41,19 +41,10 @@ oldloc = strdup(setlocale(LC_ALL, NULL)); setlocale(LC_ALL, ""); for (i = 0; i < argc; i++) { -#ifdef __APPLE__ - /* Use utf-8 on Mac OS X */ - PyObject *unicode = PyUnicode_FromString(argv[i]); - if (!unicode) - return 1; - argv_copy[i] = PyUnicode_AsWideCharString(unicode, NULL); - Py_DECREF(unicode); -#else argv_copy[i] = _Py_char2wchar(argv[i]); -#endif - argv_copy2[i] = argv_copy[i]; if (!argv_copy[i]) return 1; + argv_copy2[i] = argv_copy[i]; } setlocale(LC_ALL, oldloc); free(oldloc);
