Message174878
The test is still failing on Mac OS X:
======================================================================
FAIL: test_non_ascii (test.test_cmd_line_script.CmdLineTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Volumes/bay2/buildslave/cpython/3.x.snakebite-mountainlion-amd64/build/Lib/test/test_cmd_line_script.py", line 380, in test_non_ascii
rc, stdout, stderr = assert_python_ok(script_name)
File "/Volumes/bay2/buildslave/cpython/3.x.snakebite-mountainlion-amd64/build/Lib/test/script_helper.py", line 54, in assert_python_ok
return _assert_python(True, *args, **env_vars)
File "/Volumes/bay2/buildslave/cpython/3.x.snakebite-mountainlion-amd64/build/Lib/test/script_helper.py", line 46, in _assert_python
"stderr follows:\n%s" % (rc, err.decode('ascii', 'ignore')))
AssertionError: Process return code is 2, stderr follows:
/Volumes/bay2/buildslave/cpython/3.x.snakebite-mountainlion-amd64/build/python.exe: can't open file './@test_63568_tmp.py': [Errno 2] No such file or directory
http://buildbot.python.org/all/builders/AMD64%20Mountain%20Lion%20%5BSB%5D%203.x/builds/410/steps/test/logs/stdio
--
If I remember correctly, the command line is always decoded from UTF-8/surrogateescape on Mac OS X. That's why we have the function _Py_DecodeUTF8_surrogateescape() (for bootstrap reasons).
Such example should not work if the locale encoding is not UTF-8 on Mac OS X:
---
arg = _Py_DecodeUTF8_surrogateescape(...);
filename = _Py_wchar2char(arg);
fp = fopen(filename, "r");
---
run_file() uses a different strategy:
unicode = PyUnicode_FromWideChar(filename, wcslen(filename));
if (unicode != NULL) {
bytes = PyUnicode_EncodeFSDefault(unicode);
Py_DECREF(unicode);
}
if (bytes != NULL)
filename_str = PyBytes_AsString(bytes);
else {
PyErr_Clear();
filename_str = "<encoding error>";
}
run_file() looks to be right. Py_Main() should use similar code.
We should probably not encode and then decode the filename in each function, but this is another problem. |
|
Date |
User |
Action |
Args |
2012-11-05 08:16:55 | vstinner | set | recipients:
+ vstinner, jcea, pitrou, tim.golden, jkloth, ezio.melotti, asvetlov, skrah, gklein, python-dev, serhiy.storchaka, turncc |
2012-11-05 08:16:55 | vstinner | set | messageid: <1352103415.93.0.590371452697.issue16218@psf.upfronthosting.co.za> |
2012-11-05 08:16:55 | vstinner | link | issue16218 messages |
2012-11-05 08:16:54 | vstinner | create | |
|