#15156: Pickling with __reduce__() loops creates invalid pickles
-------------------------------------+-------------------------------------
Reporter: vbraun | Owner:
Type: defect | Status: needs_info
Priority: major | Milestone: sage-6.3
Component: misc | Resolution:
Keywords: | Merged in:
Authors: SimonKing, | Reviewers:
jkeitel, novoselt, nbruin | Work issues:
Report Upstream: N/A | Commit:
Branch: | 82ba456b8c828700d28ac36822b300f00d8b1308
u/saraedum/ticket/15156 | Stopgaps:
Dependencies: #15692 |
-------------------------------------+-------------------------------------
Comment (by nbruin):
Replying to [comment:16 saraedum]:
> There is of course lots of space for improvement, but what do you think
about this idea?
I think it's a bad idea because it doesn't solve the problem where it
needs to be solved. If the domain and codomain want to store a homset
involving them somewhere, then their unpickling should do so via
`__setstate__`, i.e., their `__reduce__` should include the homset in the
second return value, not the first. All pickling should put only the
absolute minimum in the first parameter (basically, the parameters that
can be passed to `__new__`. That's what python class pickling does too:
the entire instance `__dict__` goes into `__setstate__` for exactly that
reason.
Circularities in `__setstate__` data are not a problem. Do you actually
have a concrete example where you have observed this causing problems? I
would expect that most parents would already do the right thing, because
you'd have to work pretty hard (e.g., write a custom `__reduce__`) to mess
this up.
--
Ticket URL: <http://trac.sagemath.org/ticket/15156#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.