mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
Issue 5794: fix cPickle's unpickling of recursive tuples.
This commit is contained in:
parent
944f684ce6
commit
57bef68bc0
3 changed files with 24 additions and 10 deletions
|
@ -463,6 +463,16 @@ class AbstractPickleTests(unittest.TestCase):
|
|||
self.assertEqual(len(x), 1)
|
||||
self.assert_(x is x[0])
|
||||
|
||||
def test_recursive_tuple(self):
|
||||
t = ([],)
|
||||
t[0].append(t)
|
||||
for proto in protocols:
|
||||
s = self.dumps(t, proto)
|
||||
x = self.loads(s)
|
||||
self.assertEqual(len(x), 1)
|
||||
self.assertEqual(len(x[0]), 1)
|
||||
self.assert_(x is x[0][0])
|
||||
|
||||
def test_recursive_dict(self):
|
||||
d = {}
|
||||
d[1] = d
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue