STINNER Victor added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16218> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com