From: Ezio Melotti Date: Sat, 7 May 2011 15:29:14 +0000 (+0300) Subject: #12017: merge with 3.2. X-Git-Tag: v3.3.0a1~2369 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c18778695ab002789849e385eeb9d270633a5c6;p=python #12017: merge with 3.2. --- 9c18778695ab002789849e385eeb9d270633a5c6 diff --cc Lib/test/json_tests/test_recursion.py index 1e9b8ab757,6d5db5050e..3b29b4256f --- a/Lib/test/json_tests/test_recursion.py +++ b/Lib/test/json_tests/test_recursion.py @@@ -65,3 -65,15 +65,14 @@@ class TestRecursion(TestCase) pass else: self.fail("didn't raise ValueError on default recursion") + + + def test_highly_nested_objects(self): + # test that loading highly-nested objects doesn't segfault when C + # accelerations are used. See #12017 + with self.assertRaises(RuntimeError): + json.loads('{"a":' * 100000 + '1' + '}' * 100000) + with self.assertRaises(RuntimeError): + json.loads('{"a":' * 100000 + '[1]' + '}' * 100000) + with self.assertRaises(RuntimeError): + json.loads('[' * 100000 + '1' + ']' * 100000) -