diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-20 23:19:17 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-20 23:19:17 (GMT) |
commit | 021d55ff745268299f8c3d487aac7f12a01ec294 (patch) | |
tree | 50b07fa529066131ccf80f34b5ab4dc792ddc134 /Lib/test/test_multibytecodec.py | |
parent | 3173f7c904c057f22642d570a4be2694cacd5b15 (diff) | |
download | cpython-021d55ff745268299f8c3d487aac7f12a01ec294.zip cpython-021d55ff745268299f8c3d487aac7f12a01ec294.tar.gz cpython-021d55ff745268299f8c3d487aac7f12a01ec294.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/test_multibytecodec.py')
-rw-r--r-- | Lib/test/test_multibytecodec.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py index c38df8d..5b61e7e 100644 --- a/Lib/test/test_multibytecodec.py +++ b/Lib/test/test_multibytecodec.py @@ -43,6 +43,13 @@ class Test_MultibyteCodec(unittest.TestCase): self.assertRaises(IndexError, dec, 'apple\x92ham\x93spam', 'test.cjktest') + def test_errorcallback_custom_ignore(self): + # Issue #23215: MemoryError with custom error handlers and multibyte codecs + data = 100 * unichr(0xdc00) + 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): for enc in ALL_CJKENCODINGS: code = '# coding: {}\n'.format(enc) |