#11115: Rewrite cached_method in Cython
-----------------------------------------------------+----------------------
   Reporter:  SimonKing                              |          Owner:  jason   
                 
       Type:  enhancement                            |         Status:  
needs_info               
   Priority:  major                                  |      Milestone:  
sage-4.7.2               
  Component:  misc                                   |       Keywords:  
category cython cache    
Work_issues:                                         |       Upstream:  N/A     
                 
   Reviewer:  Nicolas M. ThiƩry, Andrey Novoseltsev  |         Author:  Simon 
King               
     Merged:                                         |   Dependencies:  #9976 
#11298 #11342 #9138
-----------------------------------------------------+----------------------

Comment(by SimonKing):

 Leif and/or Volker, what happends if you do the following? Do you get
 essentially the same as I? In particular, can the file be found?
 {{{
 sage: cython_code = ['cpdef test_meth(self,x):',
     ... '    "some doc for a wrapped cython method"',
     ... '    return -x',
     ... 'from sage.all import cached_method',
     ... 'from sage.structure.parent cimport Parent',
     ... 'cdef class MyClass(Parent):',
     ... '    wrapped_method =
 cached_method(test_meth,name="wrapped_method")']
 sage: cython('\n'.join(cython_code))
 sage: O = MyClass()
 sage: from sage.misc.sageinspect import sage_getfile, sage_getargspec
 sage: sage_getargspec(O.wrapped_method)
 ArgSpec(args=['self', 'x'], varargs=None, keywords=None, defaults=None)
 sage: sage_getfile(O.wrapped_method)
 
'/mnt/local/king/SAGE/debug/sage-4.7.2.alpha3-prerelease/devel/sage/_mnt_local_king__sage_temp_mpc622_4939_tmp_1_spyx_0.pyx'
 }}}

 Does `O.wrapped_method?` and `O.wrapped_method??` work for you, or is it
 impossible to open the source file? If the latter is the case: What is
 `O.wrapped_method.__module__`?

 I suppose that the problem is actually located in
 `_sage_getdoc_unformatted`, because for me it already returns the file and
 embedding information:
 {{{
 from sage.misc.sageinspect import _sage_getdoc_unformatted
 sage: _sage_getdoc_unformatted(O.wrapped_method)
 'File: _mnt_local_king__sage_temp_mpc622_4939_tmp_1_spyx_0.pyx (starting
 at line 6)\nsome doc for a wrapped cython method'
 }}}

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