#14017: Determine the correct argspec for python functions defined in cython 
files
------------------------------------------------+---------------------------
       Reporter:  SimonKing                     |         Owner:  jason         
                                                          
           Type:  defect                        |        Status:  needs_work    
                                                          
       Priority:  major                         |     Milestone:  sage-5.7      
                                                          
      Component:  misc                          |    Resolution:                
                                                          
       Keywords:  introspection cython argspec  |   Work issues:  Fix variable 
name in pbori, accept pointer types in function definitions
Report Upstream:  N/A                           |     Reviewers:  Travis 
Scrimshaw                                                        
        Authors:  Simon King                    |     Merged in:                
                                                          
   Dependencies:                                |      Stopgaps:                
                                                          
------------------------------------------------+---------------------------
Changes (by SimonKing):

  * status:  needs_review => needs_work
  * work_issues:  => Fix variable name in pbori, accept pointer types in
                  function definitions


Comment:

 Here is the outcome of building the reference guide from scratch, with the
 new patch:
 {{{
 
/home/simon/SAGE/debug/sage-5.6.rc0/devel/sage/doc/en/reference/sage/numerical/backends/generic_backend.rst:11:
 WARNING: error while formatting signature for
 sage.numerical.backends.generic_backend.GenericBackend.problem_name:
 Pointer types not allowed in def or cpdef functions
 
/home/simon/SAGE/debug/sage-5.6.rc0/devel/sage/doc/en/reference/sage/numerical/backends/generic_backend.rst:11:
 WARNING: error while formatting signature for
 sage.numerical.backends.generic_backend.GenericBackend.write_lp: Pointer
 types not allowed in def or cpdef functions
 
/home/simon/SAGE/debug/sage-5.6.rc0/devel/sage/doc/en/reference/sage/numerical/backends/generic_backend.rst:11:
 WARNING: error while formatting signature for
 sage.numerical.backends.generic_backend.GenericBackend.write_mps: Pointer
 types not allowed in def or cpdef functions
 
/home/simon/SAGE/debug/sage-5.6.rc0/devel/sage/doc/en/reference/sage/numerical/backends/glpk_backend.rst:11:
 WARNING: error while formatting signature for
 sage.numerical.backends.glpk_backend.GLPKBackend.print_ranges: Pointer
 types not allowed in def or cpdef functions
 
/home/simon/SAGE/debug/sage-5.6.rc0/devel/sage/doc/en/reference/sage/numerical/backends/glpk_backend.rst:11:
 WARNING: error while formatting signature for
 sage.numerical.backends.glpk_backend.GLPKBackend.problem_name: Pointer
 types not allowed in def or cpdef functions
 
/home/simon/SAGE/debug/sage-5.6.rc0/devel/sage/doc/en/reference/sage/numerical/backends/glpk_backend.rst:11:
 WARNING: error while formatting signature for
 sage.numerical.backends.glpk_backend.GLPKBackend.write_lp: Pointer types
 not allowed in def or cpdef functions
 
/home/simon/SAGE/debug/sage-5.6.rc0/devel/sage/doc/en/reference/sage/numerical/backends/glpk_backend.rst:11:
 WARNING: error while formatting signature for
 sage.numerical.backends.glpk_backend.GLPKBackend.write_mps: Pointer types
 not allowed in def or cpdef functions
 
/home/simon/SAGE/debug/sage-5.6.rc0/devel/sage/doc/en/reference/sage/rings/polynomial/pbori.rst:11:
 WARNING: error while formatting signature for
 sage.rings.polynomial.pbori.mod_mon_set: invalid syntax (<unknown>, line
 1)
 }}}

 So, in most cases, there is complaint about a '*' being inside of the type
 definition, making it a pointer type. Let's have a look:
 {{{
 cpdef problem_name(self, char * name = NULL)
 }}}
 Arrgh. I thought ''no'' pointer was allowed, but `char*` is an exception.

 Since the only requirement is that sage_getargspec correctly parses
 correct syntax, a potential solution is to simply accept a "pointed" type
 definition, whether it is legal or not.

 The last problem is different:
 {{{
 def mod_mon_set(BooleSet as, BooleSet vs):
 }}}
 `as` is a reserved name in Python -- so, it is hard to believe that Cython
 accepts it as a variable name!

 But in this case, I suggest to simply change the name in pbori.pyx, rather
 than trying to make _sage_getargspec_cython swallow it.

 I'll do the two changes tomorrow.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14017#comment:19>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to