]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Revert r85435 (and r85440): decode command line arguments from utf-8
authorVictor Stinner <victor.stinner@haypocalc.com>
Wed, 13 Oct 2010 23:24:06 +0000 (23:24 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Wed, 13 Oct 2010 23:24:06 +0000 (23:24 +0000)
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.

Misc/NEWS
Modules/python.c

index 06fbe9d2d98216679a7ca828f6a670708d02a53e..142c9fc34ef64742ea556420875def9b9eacfb7e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,9 +10,6 @@ What's New in Python 3.2 Beta 1?
 Core and Builtins
 -----------------
 
-- Issue #9992: On Mac OS X, decode command line arguments from utf-8 instead of
-  the locale encoding.
-
 - Issue #9992: Remove PYTHONFSENCODING environment variable.
 
 Library
index 488aa791d7025bd4058e1b178f2314e1caa66657..9a71cd06da93d0b1a5c29c3de8aced7ac57d298c 100644 (file)
@@ -41,19 +41,10 @@ main(int argc, char **argv)
     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);