Merged revisions 72930 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72930 | collin.winter | 2009-05-25 21:12:39 -0700 (Mon, 25 May 2009) | 1 line

  Issue 5794: fix cPickle's unpickling of recursive tuples.
........
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index e34d55b..f7099a1 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -428,6 +428,16 @@
             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
diff --git a/Lib/test/test_cpickle.py b/Lib/test/test_cpickle.py
index 0b02b62..c874481 100644
--- a/Lib/test/test_cpickle.py
+++ b/Lib/test/test_cpickle.py
@@ -64,6 +64,11 @@
                           AbstractPickleTests.test_recursive_list,
                           self)
 
+    def test_recursive_tuple(self):
+        self.assertRaises(ValueError,
+                          AbstractPickleTests.test_recursive_tuple,
+                          self)
+
     def test_recursive_inst(self):
         self.assertRaises(ValueError,
                           AbstractPickleTests.test_recursive_inst,