[Python-checkins] cpython (2.7): Don't encode unicode dirname in test_support.temp_cwd() if unicode file names
serhiy.storchaka
python-checkins at python.org
Wed Sep 9 11:20:41 CEST 2015
https://hg.python.org/cpython/rev/32893d8a52a9
changeset: 97807:32893d8a52a9
branch: 2.7
parent: 97797:55b62e2c59f8
user: Serhiy Storchaka <storchaka at gmail.com>
date: Wed Sep 09 12:18:36 2015 +0300
summary:
Don't encode unicode dirname in test_support.temp_cwd() if unicode file names
are supported by the filesystem. On Windows the encoding can convert some
characters to '?' that is not legal in file name.
files:
Lib/test/test_support.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -705,7 +705,8 @@
the CWD, an error is raised. If it's True, only a warning is raised
and the original CWD is used.
"""
- if have_unicode and isinstance(name, unicode):
+ if (have_unicode and isinstance(name, unicode) and
+ not os.path.supports_unicode_filenames):
try:
name = name.encode(sys.getfilesystemencoding() or 'ascii')
except UnicodeEncodeError:
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list