summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2007-09-10 21:38:27 (GMT)
committerBrett Cannon <bcannon@gmail.com>2007-09-10 21:38:27 (GMT)
commita0c05512ec071b98e8170c8cfe845bee6fc934da (patch)
tree83da314bd97dd8153e1ffd85f933c24087fae956 /Lib/test
parentf3d280e62acfa2d597dff13105f7fec4a5eeb8e6 (diff)
downloadcpython-a0c05512ec071b98e8170c8cfe845bee6fc934da.zip
cpython-a0c05512ec071b98e8170c8cfe845bee6fc934da.tar.gz
cpython-a0c05512ec071b98e8170c8cfe845bee6fc934da.tar.bz2
Fix a possible segfault from recursing too deep to get the repr of a list.
Closes issue #1096.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/list_tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py
index 1c799d7..a0011a4 100644
--- a/Lib/test/list_tests.py
+++ b/Lib/test/list_tests.py
@@ -46,6 +46,11 @@ class CommonTest(seq_tests.CommonTest):
self.assertEqual(str(a2), "[0, 1, 2, [...], 3]")
self.assertEqual(repr(a2), "[0, 1, 2, [...], 3]")
+ l0 = []
+ for i in xrange(sys.getrecursionlimit() + 100):
+ l0 = [l0]
+ self.assertRaises(RuntimeError, repr, l0)
+
def test_print(self):
d = self.type2test(xrange(200))
d.append(d)