Roundup Robot added the comment:
New changeset b3434c1ae503 by Victor Stinner in branch 'default':
Issue #15441, #15478: Reenable test_nonascii_abspath() on Windows
http://hg.python.org/cpython/rev/b3434c1ae503
--
___
Python tracker
STINNER Victor added the comment:
If a file name was invalid byte character,
os.chdir() raises UnicodeDecodeError() instead of WindowsError.
I believe this case is not handled correctly in Python 3.4 (version under
development) thanks to my work on issue #15478.
Thanks for the report Atsuo
Roundup Robot added the comment:
New changeset 3edc71ed19e7 by Victor Stinner in branch 'default':
Issue #15441: Skip test_nonascii_abspath() of test_genericpath on Windows
http://hg.python.org/cpython/rev/3edc71ed19e7
--
nosy: +python-dev
___
Python
STINNER Victor added the comment:
This issue (the test) should be fixed, see the issue #15478 for the real fix.
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15441
STINNER Victor victor.stin...@gmail.com added the comment:
I still would prefer if only one issue at a time gets fixed, in particular if
the two issues require independent changes.
Sorry, you are right: I created the issue #15478 for the general fix, and we
will use this issue to fix
STINNER Victor victor.stin...@gmail.com added the comment:
+@unittest.skipIf(sys.platform == 'win32',
+Win32 can fail cwd() with invalid utf8 name)
def test_nonascii_abspath(self):
You should not always skip the test on Windows: the filename is decodable in
code pages other
Atsuo Ishimoto ishim...@gembook.org added the comment:
chcp does only change the OEM code page, whereas Python uses the ANSI code
page for sys.getfilesystemencoding().
Sorry, I should have investigated the code more carefully.
Attached patch win32_bytes_filename.patch tries to solve both
Martin v. Löwis mar...@v.loewis.de added the comment:
I still would prefer if only one issue at a time gets fixed, in particular if
the two issues require independent changes. This issue is about
test_nonascii_abspath failing on the Japanese edition of Windows (see the first
sentence of the
STINNER Victor victor.stin...@gmail.com added the comment:
The following change is a major change on how Python handles undecodable
filenames on Windows:
-return PyUnicode_DecodeMBCS(s, size, NULL);
+return PyUnicode_DecodeMBCS(s, size, surrogateescape);
I disagree with this change,
STINNER Victor victor.stin...@gmail.com added the comment:
If a file name was invalid byte character, os.chdir() raises
UnicodeDecodeError() instead of WindowsError.
I realized that the problem is in the error handling: raising the OSError fails
with a UnicodeDecodeError because
Atsuo Ishimoto ishim...@gembook.org added the comment:
Yes, I know #13374, that's why I wrote
This is a byte-api issue on Windows, so we may be able to simply skip
this test.
Do you think we need a patch to avoid UnicodeDecodeError raised?
Or should we change test to skip this?
--
STINNER Victor victor.stin...@gmail.com added the comment:
Do you think we need a patch to avoid UnicodeDecodeError raised?
Or should we change test to skip this?
It's a bug, the test should not be skipped. You should get an OSError
because the chdir() failed, not an UnicodeDecodeError.
Martin v. Löwis mar...@v.loewis.de added the comment:
As for your patch: you are missing the point of the test. The file name is
assumed to be valid, despite it not being in the file system encoding.
--
___
Python tracker rep...@bugs.python.org
Martin v. Löwis mar...@v.loewis.de added the comment:
IMO, it is ok to skip the test on Windows; it was apparently targeted for Unix.
If we preserve it, we should pick a file name (on Windows) which is encodable
in the file system encoding.
--
___
STINNER Victor victor.stin...@gmail.com added the comment:
decode_filename_mbcs.patch uses the replace error handler to decode
the filename on Windows. It should solve the issue.
--
Added file: http://bugs.python.org/file26515/decode_filename_mbcs.patch
Martin v. Löwis mar...@v.loewis.de added the comment:
haypo: how is this meant to fix the bug? Won't it now cause a WindowsError,
when a successful operation is expected?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15441
STINNER Victor victor.stin...@gmail.com added the comment:
haypo: how is this meant to fix the bug?
Won't it now cause a WindowsError, when a successful
operation is expected?
Oh, I was referring to the new test proposed in the attached patch
(issue15441.patch):
+def
Atsuo Ishimoto ishim...@gembook.org added the comment:
Here's another try:
In this patch:
- skip test_nonascii_abspath() test since it fails on some code pages.
- Added a test to reproduce bug on latin code pages.
- Use repr(filename) only if decode failed. This is more backward-compatible
Atsuo Ishimoto ishim...@gembook.org added the comment:
martin: while os.mkdir(b'\xe7w\xf0') succeeds, but strangely enough, subsequent
os.chdir(b'\xe7w\xf0') fails.
This is not a bug in Python, but Windows issue.
--
___
Python tracker
Atsuo Ishimoto ishim...@gembook.org added the comment:
Updated patch again.
In this patch, byte object is passed as argument to WindowsError as Victor's
patch.
I prefer to fix PyErr_SetFromWindowsErrWithFilename() over path_error(),
because PyErr_SetFromWindowsErrWithFilename() is public
New submission from Atsuo Ishimoto ishim...@gembook.org:
test_posixpath.PosixCommonTest.test_nonascii_abspath fails on Japanese edition
of Windows.
If a file name was invalid byte character, os.chdir() raises
UnicodeDecodeError()
instead of WindowsError.
This is a byte-api issue on Windows,
Atsuo Ishimoto ishim...@gembook.org added the comment:
changed name of test method. In the old patch, new test method shadowed
existing one.
--
Added file: http://bugs.python.org/file26502/test_nonascii_abspath_2.patch
___
Python tracker
Changes by Atsuo Ishimoto ishim...@gembook.org:
Removed file: http://bugs.python.org/file26500/test_nonascii_abspath.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15441
___
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +haypo
stage: - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15441
___
___
Changes by Atsuo Ishimoto ishim...@gembook.org:
Removed file: http://bugs.python.org/file26502/test_nonascii_abspath_2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15441
___
Atsuo Ishimoto ishim...@gembook.org added the comment:
I'm sorry, I generated a patch in wrong direction.
--
Added file: http://bugs.python.org/file26506/issue15441.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15441
26 matches
Mail list logo