From f29ab72162d9bec16c482e4657119135d933825b Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 9 Sep 2015 12:18:36 +0300 Subject: 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. --- Lib/test/test_support.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index b578bcd..7ce1c73 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: -- cgit v0.12