diff options
Diffstat (limited to 'Lib/json')
-rw-r--r-- | Lib/json/tests/test_dump.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/json/tests/test_dump.py b/Lib/json/tests/test_dump.py index 9a7c8cc..cd92569 100644 --- a/Lib/json/tests/test_dump.py +++ b/Lib/json/tests/test_dump.py @@ -19,5 +19,14 @@ class TestDump(object): {2: 3.0, 4.0: 5L, False: 1, 6L: True}, sort_keys=True), '{"false": 1, "2": 3.0, "4.0": 5, "6": true}') + # Issue 16228: Crash on encoding resized list + def test_encode_mutated(self): + a = [object()] * 10 + def crasher(obj): + del a[-1] + self.assertEqual(self.dumps(a, default=crasher), + '[null, null, null, null, null]') + + class TestPyDump(TestDump, PyTest): pass class TestCDump(TestDump, CTest): pass |