From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 6 Dec 2018 07:22:17 +0000 (-0800) Subject: bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278) X-Git-Tag: v3.7.2rc1~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b1438c0d376e1d438a11927e2698e3317da0d854;p=thirdparty%2FPython%2Fcpython.git bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278) (cherry picked from commit 8752dfbd1f0c96ca09cdacabaf0d0f8c3895b6ce) Co-authored-by: native-api --- diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 2768e1147946..512e354fabc8 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -852,7 +852,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: