#11115: Rewrite cached_method in Cython
--------------------------------------------+-------------------------------
   Reporter:  SimonKing                     |          Owner:  jason            
              
       Type:  enhancement                   |         Status:  needs_work       
              
   Priority:  major                         |      Milestone:  sage-4.7.2       
              
  Component:  misc                          |       Keywords:  category cython 
cache          
Work_issues:  Pickling of cached functions  |       Upstream:  N/A              
              
   Reviewer:                                |         Author:  Simon King       
              
     Merged:                                |   Dependencies:  sage-4.7, #9976, 
#11298, #11342
--------------------------------------------+-------------------------------
Changes (by SimonKing):

  * status:  needs_review => needs_work
  * work_issues:  => Pickling of cached functions


Comment:

 I'd like to add one functionality: Pickling of cached functions!

 Cached methods can be pickled. However, cached functions can not. Without
 my patch (in sage-4.6.2):
 {{{
 sage: from sage.databases.cunningham_tables import
 cunningham_prime_factors
 sage: loads(dumps(cunningham_prime_factors))
 ---------------------------------------------------------------------------
 PicklingError                             Traceback (most recent call
 last)

 /home/king/SAGE/work/categories/objects/<ipython console> in <module>()

 /mnt/local/king/SAGE/broken/local/lib/python2.6/site-
 packages/sage/structure/sage_object.so in sage.structure.sage_object.dumps
 (sage/structure/sage_object.c:8348)()

 PicklingError: Can't pickle <type 'function'>: attribute lookup
 __builtin__.function failed
 }}}

 With my patch:
 {{{
 sage: loads(dumps(cunningham_prime_factors))
 Cached version of None
 }}}

 The last one is a bit grotesque... Anyway, I think it should be easy to
 add a an unpickling function that recovers a cached method from its name
 and module.

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