Skip to content

Commit b1438c0

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 3c6b0d9 commit b1438c0

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
@@ -852,7 +852,11 @@ def dec(*args, **kwargs):
852852
'\u20AC',
853853
):
854854
try:
855-
os.fsdecode(os.fsencode(character))
855+
# If Python is set up to use the legacy 'mbcs' in Windows,
856+
# 'replace' error mode is used, and encode() returns b'?'
857+
# for characters missing in the ANSI codepage
858+
if os.fsdecode(os.fsencode(character)) != character:
859+
raise UnicodeError
856860
except UnicodeError:
857861
pass
858862
else:

0 commit comments

Comments
 (0)