]> granicus.if.org Git - python/commitdiff
#12017: merge with 3.2.
authorEzio Melotti <ezio.melotti@gmail.com>
Sat, 7 May 2011 15:29:14 +0000 (18:29 +0300)
committerEzio Melotti <ezio.melotti@gmail.com>
Sat, 7 May 2011 15:29:14 +0000 (18:29 +0300)
1  2 
Lib/test/json_tests/test_recursion.py
Misc/NEWS
Modules/_json.c

index 1e9b8ab757f3529a96872fc8976e8f821a834735,6d5db5050eebe6e7956935acb09cebfe4c24a3ba..3b29b4256fb535824ea2a0b05fb66658afad213d
@@@ -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)
diff --cc Misc/NEWS
Simple merge
diff --cc Modules/_json.c
Simple merge