#12719: Upgrade to IPython 0.13
----------------------------------------------------------+-----------------
       Reporter:  kini                                    |         Owner:  tbd 
                                  
           Type:  enhancement                             |        Status:  
needs_review                          
       Priority:  critical                                |     Milestone:  
sage-5.4                              
      Component:  packages                                |    Resolution:      
                                  
       Keywords:  sd40.5                                  |   Work issues:  
Cython method printing                
Report Upstream:  N/A                                     |     Reviewers:  
Volker Braun, Mike Hansen, Jason Grout
        Authors:  Mike Hansen, Volker Braun, Jason Grout  |     Merged in:      
                                  
   Dependencies:  #13459                                  |      Stopgaps:      
                                  
----------------------------------------------------------+-----------------

Comment (by jhpalmieri):

 Replying to [comment:154 jason]:
 > The cython function printing issue appears to boil down to those
 functions being treated as builtin functions, so this line applies:
 https://github.com/ipython/ipython/blob/master/IPython/lib/pretty.py#L669,
 rather than this line:
 https://github.com/ipython/ipython/blob/master/IPython/lib/pretty.py#L671
 >
 > Suggestions for how to fix this?  How do we distinguish between built-in
 functions and Cython methods?

 I don't know. Even in previous versions of Sage:
 {{{
 sage: type(4.gcd)
 <type 'builtin_function_or_method'>
 }}}
 I wonder if changing this would require patching Cython. If we knew where
 the methods for Cython methods were defined, maybe we could just define a
 method `_repr_pretty_`, as described in
 https://github.com/ipython/ipython/blob/master/IPython/lib/pretty.py#L27.
 Line 3737-3740 of `local/lib/python/site-
 packages/Cython/Compiler/Nodes.py` says
 {{{
         is_builtin_function_or_method = "PyCFunction_Check(%s)" %
 func_node_temp
         is_overridden = "(PyCFunction_GET_FUNCTION(%s) !=
 (PyCFunction)%s)" % (
             func_node_temp, self.py_func.entry.func_cname)
 }}}
 Is this relevant?

 Alternatively, we could patch the file "pretty.py", modifying the
 definition of `_type_pprinters` somehow, although I'm not sure how.

 Alternatively, we could temporarily accept the new print representation
 for Cython-defined methods, and create a new ticket for fixing this. It
 seems like a small issue to me, and maybe it shouldn't hold up the rest of
 this ticket.

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