Kaydet (Commit) f29ab721 authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

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.
üst e1d38b08
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment