[Python-checkins] bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278)

Miss Islington (bot) webhook-mailer at python.org
Thu Dec 6 02:26:54 EST 2018


https://github.com/python/cpython/commit/af31228650d30f02a283d291ba106e84275a04c1
commit: af31228650d30f02a283d291ba106e84275a04c1
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018年12月05日T23:26:51-08:00
summary:
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 <ivan_pozdeev at mail.ru>
files:
M Lib/test/support/__init__.py
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index c0627dc14ef0..66c0fed8411c 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -857,7 +857,11 @@ def dec(*args, **kwargs):
 '\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:


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /