summaryrefslogtreecommitdiffstats
path: root/Lib/test/list_tests.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-12-03 20:12:11 (GMT)
committerGitHub <noreply@github.com>2017-12-03 20:12:11 (GMT)
commit1fb72d2ad243c965d4432b4e93884064001a2607 (patch)
tree00296a976e5e386a94c0bb6f8ed535b1c30621f5 /Lib/test/list_tests.py
parenteea3cc1ef0dec0af193eedb4c1164263fbdfd8cc (diff)
downloadcpython-1fb72d2ad243c965d4432b4e93884064001a2607.zip
cpython-1fb72d2ad243c965d4432b4e93884064001a2607.tar.gz
cpython-1fb72d2ad243c965d4432b4e93884064001a2607.tar.bz2
bpo-32137: The repr of deeply nested dict now raises a RecursionError (#4570)
instead of crashing due to a stack overflow. This perhaps will fix similar problems in other extension types.
Diffstat (limited to 'Lib/test/list_tests.py')
-rw-r--r--Lib/test/list_tests.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py
index ce9db9a..ed63fda 100644
--- a/Lib/test/list_tests.py
+++ b/Lib/test/list_tests.py
@@ -53,10 +53,11 @@ class CommonTest(seq_tests.CommonTest):
self.assertEqual(str(a2), "[0, 1, 2, [...], 3]")
self.assertEqual(repr(a2), "[0, 1, 2, [...], 3]")
- l0 = []
+ def test_repr_deep(self):
+ a = self.type2test([])
for i in range(sys.getrecursionlimit() + 100):
- l0 = [l0]
- self.assertRaises(RecursionError, repr, l0)
+ a = self.type2test([a])
+ self.assertRaises(RecursionError, repr, a)
def test_print(self):
d = self.type2test(range(200))