summaryrefslogtreecommitdiffstats
path: root/Lib/test/json_tests
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2011-05-07 15:15:34 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2011-05-07 15:15:34 (GMT)
commit06383ee090e3c66130db9dc0b562fba3cb749be1 (patch)
tree911f4ebf7e1e6c4e25e7d24bf39925f6ba156f75 /Lib/test/json_tests
parentb0b0579625defd7ec370680075fb8ce46db4cd20 (diff)
parent362b95102f76d042e7f3865c1ebec5d36c79959a (diff)
downloadcpython-06383ee090e3c66130db9dc0b562fba3cb749be1.zip
cpython-06383ee090e3c66130db9dc0b562fba3cb749be1.tar.gz
cpython-06383ee090e3c66130db9dc0b562fba3cb749be1.tar.bz2
#12017: merge with 3.1.
Diffstat (limited to 'Lib/test/json_tests')
-rw-r--r--Lib/test/json_tests/test_recursion.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/json_tests/test_recursion.py b/Lib/test/json_tests/test_recursion.py
index 1e9b8ab..6d5db50 100644
--- a/Lib/test/json_tests/test_recursion.py
+++ b/Lib/test/json_tests/test_recursion.py
@@ -65,3 +65,15 @@ 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)
+