summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-06-16 23:33:54 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-06-16 23:33:54 (GMT)
commit554f3f0081fc8f3561b031d957ffbab1034d8b83 (patch)
treef329005e253141249813de35f3f89ea2c979809f /Lib
parent79ee19f3db964733d4fe94184dbb65bc819c65ce (diff)
downloadcpython-554f3f0081fc8f3561b031d957ffbab1034d8b83.zip
cpython-554f3f0081fc8f3561b031d957ffbab1034d8b83.tar.gz
cpython-554f3f0081fc8f3561b031d957ffbab1034d8b83.tar.bz2
Issue #850997: mbcs encoding (Windows only) handles errors argument: strict
mode raises unicode errors. The encoder only supports "strict" and "replace" error handlers, the decoder only supports "strict" and "ignore" error handlers.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/__init__.py2
-rw-r--r--Lib/test/test_codecs.py7
2 files changed, 2 insertions, 7 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index 8782db9..ce1d779 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -265,7 +265,7 @@ except ImportError:
pass
else:
if _os.name in ("nt", "ce"):
- set_conversion_mode("mbcs", "ignore")
+ set_conversion_mode("mbcs", "strict")
else:
set_conversion_mode("ascii", "strict")
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 911d58f..521cbce 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -1358,11 +1358,6 @@ broken_incremental_coders = broken_unicode_with_streams + [
"idna",
]
-# The following encodings only support "strict" mode
-only_strict_mode = [
- "idna",
-]
-
class BasicUnicodeTest(unittest.TestCase, MixInCheckStateHandling):
def test_basics(self):
s = "abc123" # all codecs should be able to encode these
@@ -1437,7 +1432,7 @@ class BasicUnicodeTest(unittest.TestCase, MixInCheckStateHandling):
result = "".join(codecs.iterdecode(codecs.iterencode("", encoding), encoding))
self.assertEqual(result, "")
- if encoding not in only_strict_mode:
+ if encoding not in ("idna", "mbcs"):
# check incremental decoder/encoder with errors argument
try:
encoder = codecs.getincrementalencoder(encoding)("ignore")