]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278)
authornative-api <ivan_pozdeev@mail.ru>
Thu, 6 Dec 2018 07:04:35 +0000 (10:04 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 6 Dec 2018 07:04:35 +0000 (09:04 +0200)
Lib/test/support/__init__.py

index f90212cd7ecf8bb839647efdef75e0db6918f750..05e8593f9825a21eb44259420ecc78756c4e6eba 100644 (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: