[ python-Bugs-998998 ] pickle bug - recursively memoizing class?

SourceForge.net noreply at sourceforge.net
Tue Jul 27 22:57:42 CEST 2004


Bugs item #998998, was opened at 2004-07-27 15:55
Message generated for change (Comment added) made by montanaro
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=998998&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Nobody/Anonymous (nobody)
Summary: pickle bug - recursively memoizing class?

Initial Comment:
The attached script (picklecycle.py) gives me an
assertion error
in Pickler.memoize().  Maybe I'm just doing something dumb.
I have very little experience with pickle and even less
experience
pickling new-style class instances.  I'm just trying to
adapt an
existing messy object graph to allow it to be pickled.
 I realize the
two instances refer to each other, but I thought pickle was
supposed to gracefully handle cyclic object graphs.

I can worm around the problem a couple ways.  First,
getting
rid of new-style classes does the trick.  Also
modifying B.__reduce__
to not return self.__dict__ seems to do the trick.

Output (cycle.out) and a modified version of
Pickler.memoize
(memoize.py) will be attached momentarily.


----------------------------------------------------------------------

>Comment By: Skip Montanaro (montanaro)
Date: 2004-07-27 15:57

Message:
Logged In: YES 
user_id=44345

Attaching the output I see when running picklecycle.py w/ the
modified memoize() method (cycle.out).

----------------------------------------------------------------------

Comment By: Skip Montanaro (montanaro)
Date: 2004-07-27 15:56

Message:
Logged In: YES 
user_id=44345

Attaching chatty version of Pickler.memoize()


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=998998&group_id=5470


More information about the Python-bugs-list mailing list