summaryrefslogtreecommitdiffstats
path: root/Modules/python.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-10-13 23:24:06 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-10-13 23:24:06 (GMT)
commit052a04d34a3841996af59962b038f05af63abacc (patch)
tree763e4056730872f8b5c19f8e847c36c2c4a1c303 /Modules/python.c
parent59a289d16b6716f3f106ee14c5562186cda310b2 (diff)
downloadcpython-052a04d34a3841996af59962b038f05af63abacc.zip
cpython-052a04d34a3841996af59962b038f05af63abacc.tar.gz
cpython-052a04d34a3841996af59962b038f05af63abacc.tar.bz2
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.
Diffstat (limited to 'Modules/python.c')
-rw-r--r--Modules/python.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/Modules/python.c b/Modules/python.c
index 488aa79..9a71cd0 100644
--- a/Modules/python.c
+++ b/Modules/python.c
@@ -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);