diff options
Diffstat (limited to 'Lib/test/json_tests/test_dump.py')
-rw-r--r-- | Lib/test/json_tests/test_dump.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/json_tests/test_dump.py b/Lib/test/json_tests/test_dump.py index 4b3386f..237ee35 100644 --- a/Lib/test/json_tests/test_dump.py +++ b/Lib/test/json_tests/test_dump.py @@ -20,6 +20,14 @@ class TestDump: {2: 3.0, 4.0: 5, False: 1, 6: 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 |