bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278)

This commit is contained in:
native-api 2018-12-06 10:04:35 +03:00 committed by Serhiy Storchaka
parent 6ea9d54dea
commit 8752dfbd1f
1 changed files with 5 additions and 1 deletions

View File

@ -871,7 +871,11 @@ for character in (
'\u20AC',
):
try:
os.fsdecode(os.fsencode(character))
# If Python is set up to use the legacy 'mbcs' in Windows,
# 'replace' error mode is used, and encode() returns b'?'
# for characters missing in the ANSI codepage
if os.fsdecode(os.fsencode(character)) != character:
raise UnicodeError
except UnicodeError:
pass
else: