mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
Fix #2702, with a correct accounting of recursion.
This commit is contained in:
parent
1e022689b7
commit
763d309bba
2 changed files with 25 additions and 25 deletions
|
@ -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=[]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue