mirror of
https://github.com/python/cpython.git
synced 2025-09-21 08:00:37 +00:00
Issue #23215: Multibyte codecs with custom error handlers that ignores errors
consumed too much memory and raised SystemError or MemoryError. Original patch by Aleksi Torhamo.
This commit is contained in:
parent
a3712a9a6c
commit
a1543cdcd6
3 changed files with 22 additions and 8 deletions
|
@ -44,6 +44,13 @@ class Test_MultibyteCodec(unittest.TestCase):
|
|||
self.assertRaises(IndexError, dec,
|
||||
b'apple\x92ham\x93spam', 'test.cjktest')
|
||||
|
||||
def test_errorcallback_custom_ignore(self):
|
||||
# Issue #23215: MemoryError with custom error handlers and multibyte codecs
|
||||
data = 100 * "\udc00"
|
||||
codecs.register_error("test.ignore", codecs.ignore_errors)
|
||||
for enc in ALL_CJKENCODINGS:
|
||||
self.assertEqual(data.encode(enc, "test.ignore"), b'')
|
||||
|
||||
def test_codingspec(self):
|
||||
try:
|
||||
for enc in ALL_CJKENCODINGS:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue