From af31228650d30f02a283d291ba106e84275a04c1 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Wed, 5 Dec 2018 23:26:51 -0800 Subject: 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 --- Lib/test/support/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index c0627dc..66c0fed 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -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: -- cgit v0.12