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 belopolsky
Recipients alexandre.vassalotti, belopolsky, eric.araujo, grubert, rhettinger, schmir, zzzeek
Date 2010-07-16.00:16:55
SpamBayes Score 8.328253e-09
Marked as misclassified No
Message-id <>
I am reclassifying this as an RFE because as a bug, this is a duplicate of issue1062277.  The later contains an excellent description of the problem by Dima Dorfman:

     Our pickle implementations don't check for reduce
     cycles. This is somewhat cosmetic except that stack
     overflow protection is imperfect (for cPickle), causing
     crashes, and some kinds of cycles trigger asserts (in
     pickle).  [msg47267]

This is undeniably a bug and the solution offered in issue1062277 is quite reasonable: detect reduce cycles and bail out with an informative message.  This will not solve the problem of pickling self-referencing sets, but at least once documented can be defended as expected behavior.

What remains after issue1062277 is a feature request to allow pickling of self-referencing sets.  I would argue that this is really a pathological case.  Sets are not supposed to contain mutable items and immutable objects cannot create reference cycles among themselves.

The test case in tricks set into accepting mutable objects by creating a class with default __hash__.  This falls into a category of "don't do it".

I am lowering the priority and adding #1062277 as a dependency.  Once #1062277 is fixed, I would not mind closing this as "won't fix".
Date User Action Args
2010-07-16 00:17:01belopolskysetrecipients: + belopolsky, rhettinger, grubert, alexandre.vassalotti, schmir, eric.araujo, zzzeek
2010-07-16 00:17:00belopolskysetmessageid: <>
2010-07-16 00:16:58belopolskylinkissue9269 messages
2010-07-16 00:16:55belopolskycreate