#11115: Rewrite cached_method in Cython
---------------------------+------------------------------------------------
   Reporter:  SimonKing    |       Owner:  jason                
       Type:  enhancement  |      Status:  needs_review         
   Priority:  major        |   Milestone:  sage-4.7             
  Component:  misc         |    Keywords:  category cython cache
     Author:  Simon King   |    Upstream:  N/A                  
   Reviewer:               |      Merged:                       
Work_issues:               |  
---------------------------+------------------------------------------------

Comment(by SimonKing):

 I just updated the patch, because I noticed the following: If you have an
 old pickle of an object with a cached method then of course the pickle
 will contain the cached value. If you unpickle then it may be that an old
 `CachedMethodCaller` becomes a new `CachedMethodCallerNoArgs`.

 It would thus be nice if `CachedMethodCallerNoArgs` could retrieve the
 cache value of an old pickled `CachedMethodCaller`. This is implemented in
 the new patch.

 What I did to test it:

 1. Without the patch applied, do
 {{{
 sage: P.<a,b,c,d> = QQ[]
 sage: I = P*[a,b]
 sage: I.gens()  # this is in order to fill the cache - it is a
 CachedMethodCaller
 sage: save(I,'pickletest')
 }}}

 2. With the patch applied, do
 {{{
 sage: I = load('pickletest')
 sage: I.gens.cache   # this is now a CachedMethodCallerNoArgs
 [a, b]
 }}}
 So, the cache is already filled after unpickling.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11115#comment:14>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to