summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-20 23:21:08 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-20 23:21:08 (GMT)
commitdf80706f141bf3de5326750e4646161355d65881 (patch)
tree6a8409b69e28acd64efa8c0c33627657cbe60279 /Lib/test
parent254dd59068e027f98a1f9ac5b81e43e4685e5ac6 (diff)
parenta1543cdcd65d9a2be302be0da0cfb9c53c17f806 (diff)
downloadcpython-df80706f141bf3de5326750e4646161355d65881.zip
cpython-df80706f141bf3de5326750e4646161355d65881.tar.gz
cpython-df80706f141bf3de5326750e4646161355d65881.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')
-rw-r--r--Lib/test/test_multibytecodec.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
index ce267dd..2929f98 100644
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -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: