From: Serhiy Storchaka Date: Wed, 9 Sep 2015 09:18:36 +0000 (+0300) Subject: Don't encode unicode dirname in test_support.temp_cwd() if unicode file names X-Git-Tag: v2.7.11rc1~165 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f29ab72162d9bec16c482e4657119135d933825b;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index b578bcd6a791..7ce1c73b28ce 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -705,7 +705,8 @@ def temp_cwd(name='tempcwd', quiet=False): 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: