]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 6 Dec 2018 07:26:51 +0000 (23:26 -0800)
committerGitHub <noreply@github.com>
Thu, 6 Dec 2018 07:26:51 +0000 (23:26 -0800)
(cherry picked from commit 8752dfbd1f0c96ca09cdacabaf0d0f8c3895b6ce)

Co-authored-by: native-api <ivan_pozdeev@mail.ru>
Lib/test/support/__init__.py

index c0627dc14ef06726f1acffb7968f8975fdda08bc..66c0fed8411c19e6a7395809d979674a61911568 100644 (file)
@@ -857,7 +857,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: