This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alexandre.vassalotti
Recipients BreamoreBoy, ajaksu2, alexandre.vassalotti, georg.brandl, tovrstra
Date 2013-05-03.01:33:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1367544791.84.0.781926255549.issue892902@psf.upfronthosting.co.za>
In-reply-to
Content
I fixed this while working on PEP 3154 [http://hg.python.org/features/pep-3154-alexandre/rev/eed9142d664f]. The relevant piece is

@@ -420,7 +424,13 @@ class _Pickler:
             write(REDUCE)
 
         if obj is not None:
-            self.memoize(obj)
+            # If the object is already in the memo, this means it is
+            # recursive. In this case, throw away everything we put on the
+            # stack, and fetch the object back from the memo.
+            if id(obj) in self.memo:
+                write(POP + self.get(self.memo[id(obj)][0]))
+            else:
+                self.memoize(obj)
 
         # More new special cases (that work with older protocols as
         # well): when __reduce__ returns a tuple with 4 or 5 items,

It would be pretty easy to backport this to 2.7 and 3.3. It is also good to mention that that only protocol 0 and 1 are affected.
History
Date User Action Args
2013-05-03 01:33:11alexandre.vassalottisetrecipients: + alexandre.vassalotti, georg.brandl, tovrstra, ajaksu2, BreamoreBoy
2013-05-03 01:33:11alexandre.vassalottisetmessageid: <1367544791.84.0.781926255549.issue892902@psf.upfronthosting.co.za>
2013-05-03 01:33:11alexandre.vassalottilinkissue892902 messages
2013-05-03 01:33:11alexandre.vassalotticreate