Message110402
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 cycle.py 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:01 | belopolsky | set | recipients:
+ belopolsky, rhettinger, grubert, alexandre.vassalotti, schmir, eric.araujo, zzzeek |
2010-07-16 00:17:00 | belopolsky | set | messageid: <1279239420.6.0.58008658097.issue9269@psf.upfronthosting.co.za> |
2010-07-16 00:16:58 | belopolsky | link | issue9269 messages |
2010-07-16 00:16:55 | belopolsky | create | |
|