Fix #2702, with a correct accounting of recursion.

This commit is contained in:
Facundo Batista 2008-06-30 01:10:55 +00:00
parent 1e022689b7
commit 763d309bba
2 changed files with 25 additions and 25 deletions

View file

@ -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=[]))