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 b578bcd..7ce1c73 100644
--- 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: