#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             |
-------------------------------------+-------------------------------------

Comment (by saraedum):

 Do you have any idea how I could implement that? I could for example
 implement {{{__getstate__}}} for sage parents and elements, but then
 whenever it is overwritten I would have to rely on the super
 implementation being called. I could also implement {{{__copy__}}} there
 which is muss less likely to be overwritten but still the problem is the
 same.
 The problem is that unlike with pickling, {{{__getstate__}}} is not called
 on the cached methods when a shallow copy is made (only for a deep copy.)
 One thing I could think of is putting the {{{id}}} of the original object
 into each of its caches. Any call to the cache could check that id (which
 could be a small but significant performance loss) and complain if it does
 not match the element the cache is associated to.

 I think that implementing {{{__copy__}}} is probably the best path to
 take.

--
Ticket URL: <http://trac.sagemath.org/ticket/15692#comment:22>
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.

Reply via email to