diff options
author | Facundo Batista <facundobatista@gmail.com> | 2008-06-30 01:10:55 (GMT) |
---|---|---|
committer | Facundo Batista <facundobatista@gmail.com> | 2008-06-30 01:10:55 (GMT) |
commit | 763d309bba339c8609484c1cb03942ba684aa40c (patch) | |
tree | 310e4687a6aaa4fd837345f36cc91712536a2fdc /Lib | |
parent | 1e022689b71118d09815fb36173dccbb3bb33447 (diff) | |
download | cpython-763d309bba339c8609484c1cb03942ba684aa40c.zip cpython-763d309bba339c8609484c1cb03942ba684aa40c.tar.gz cpython-763d309bba339c8609484c1cb03942ba684aa40c.tar.bz2 |
Fix #2702, with a correct accounting of recursion.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_cpickle.py | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/Lib/test/test_cpickle.py b/Lib/test/test_cpickle.py index 7d3fc97..0b02b62 100644 --- a/Lib/test/test_cpickle.py +++ b/Lib/test/test_cpickle.py @@ -94,23 +94,19 @@ class Node(object): pass class cPickleDeepRecursive(unittest.TestCase): -# I commented out, because the patch that fixes this was reverted, as -# it broke the next test case. Check the issues for full history. -# def test_issue2702(self): -# '''This should raise a RecursionLimit but in some -# platforms (FreeBSD, win32) sometimes raises KeyError instead, -# or just silently terminates the interpreter (=crashes). -# ''' -# nodes = [Node() for i in range(500)] -# for n in nodes: -# n.connections = list(nodes) -# n.connections.remove(n) -# self.assertRaises(RuntimeError, cPickle.dumps, n) + def test_issue2702(self): + # This should raise a RecursionLimit but in some + # platforms (FreeBSD, win32) sometimes raises KeyError instead, + # or just silently terminates the interpreter (=crashes). + nodes = [Node() for i in range(500)] + for n in nodes: + n.connections = list(nodes) + n.connections.remove(n) + self.assertRaises(RuntimeError, cPickle.dumps, n) def test_issue3179(self): - '''Safe test, because of I broken this case when fixing the - behaviour for the previous test. - ''' + # Safe test, because I broke this case when fixing the + # behaviour for the previous test. res=[] for x in range(1,2000): res.append(dict(doc=x, similar=[])) |