#15692: Value of cached methods should not always be pickled
-------------------------------------+-------------------------------------
Reporter: SimonKing | Owner:
Type: defect | Status: needs_info
Priority: major | Milestone: sage-6.9
Component: pickling | Resolution:
Keywords: pickling hash | Merged in:
cache | Reviewers: Vincent Delecroix
Authors: Julian Rueth | Work issues:
Report Upstream: N/A | Commit:
Branch: | b2aa4073a6724e0c92c719f8d3eb232ef0bc2102
u/saraedum/ticket/15692 | Stopgaps:
Dependencies: #16337 |
-------------------------------------+-------------------------------------
Changes (by saraedum):
* cc: nthiery (added)
Comment:
Trying to implement this, I realized that the point of the
`ClearCacheOnPickle` on these classes was certainly not to clear *all*
caches on copy.
Also, `ClearCacheOnPickle` is broken, since it replaces any cache
dictionary with an actual `dict` , i.e., it would replace a weak
dictionary with a regular one.)
I guess there was in each case some cached method which should not be
pickled (or probably copied.)
So it is probably better to look at the actual occurences and fix the
copying there instead of just hacking a "drop some caches" `__copy__`
method which probably does too much and might even break if we change the
cached methods next time around.
The classes which carry `ClearCacheOnPickle` are:
* `ToricVariety_field` where it was added in `0be2c23d` with the comment
"Do not pickle caches of toric varieties". So it could be alright if we
still copied them.
* `WeilGroup_gens` where it was added when the class did not provide the
functionality to clear caches on copy. So it might be alright to copy
them.
* `AmbientSpace` and `RootSpace` where it is not clear why it was added
exactly. Maybe Nicolas could clarify this (author of the commit which
added it.)
Btw. the lengthy discussion in #11115 (this is where the clear caches on
copy was introduced) does not make any mention of "copy".
--
Ticket URL: <http://trac.sagemath.org/ticket/15692#comment:25>
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.