diff options
author | Collin Winter <collinw@gmail.com> | 2009-05-26 04:12:39 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2009-05-26 04:12:39 (GMT) |
commit | 57bef68bc0537797a23af92611e497bf3314c81c (patch) | |
tree | 5fa9af8ada8600764ea92839daafc788c571645b /Lib/test/pickletester.py | |
parent | 944f684ce6f439bc868d4b189c45f726dfb9d3b1 (diff) | |
download | cpython-57bef68bc0537797a23af92611e497bf3314c81c.zip cpython-57bef68bc0537797a23af92611e497bf3314c81c.tar.gz cpython-57bef68bc0537797a23af92611e497bf3314c81c.tar.bz2 |
Issue 5794: fix cPickle's unpickling of recursive tuples.
Diffstat (limited to 'Lib/test/pickletester.py')
-rw-r--r-- | Lib/test/pickletester.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index bc0be1f..ce49fdd 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -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 |