mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
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.
This commit is contained in:
parent
79ee19f3db
commit
554f3f0081
5 changed files with 149 additions and 45 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue