mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Reverting the patch from #3165, as it broke other
behaviours. I left the original test commented out (note that that test came from #2702, which seems to have a problem in FreeBSD and Windows, but not in Linux). I included a new test, to watch over the now-broken behaviour, I took it from #3179.
This commit is contained in:
parent
1b6c4c80a3
commit
68dc052ca6
2 changed files with 22 additions and 14 deletions
|
@ -94,16 +94,28 @@ class Node(object):
|
|||
pass
|
||||
|
||||
class cPickleDeepRecursive(unittest.TestCase):
|
||||
'''Issue 2702. This should raise a RecursionLimit but in some
|
||||
platforms (FreeBSD, win32) sometimes raises KeyError instead,
|
||||
or just silently terminates the interpreter (=crashes).
|
||||
'''
|
||||
def test_deep_recursive(self):
|
||||
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)
|
||||
# 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_issue3179(self):
|
||||
'''Safe test, because of I broken this case when fixing the
|
||||
behaviour for the previous test.
|
||||
'''
|
||||
res=[]
|
||||
for x in range(1,2000):
|
||||
res.append(dict(doc=x, similar=[]))
|
||||
cPickle.dumps(res)
|
||||
|
||||
|
||||
def test_main():
|
||||
test_support.run_unittest(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue