Skip to content

Commit af31228

Browse files
bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278)
(cherry picked from commit 8752dfb) Co-authored-by: native-api <[email protected]>
1 parent eb38ee0 commit af31228

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Lib/test/support/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,11 @@ def dec(*args, **kwargs):
857857
'\u20AC',
858858
):
859859
try:
860-
os.fsdecode(os.fsencode(character))
860+
# If Python is set up to use the legacy 'mbcs' in Windows,
861+
# 'replace' error mode is used, and encode() returns b'?'
862+
# for characters missing in the ANSI codepage
863+
if os.fsdecode(os.fsencode(character)) != character:
864+
raise UnicodeError
861865
except UnicodeError:
862866
pass
863867
else:

0 commit comments

Comments
 (0)