#7913: extraneous output after deprecation warning
------------------------------+---------------------------------------------
   Reporter:  cremona         |          Owner:  was        
       Type:  defect          |         Status:  new        
   Priority:  minor           |      Milestone:  sage-5.0   
  Component:  user interface  |       Keywords:  deprecation
Work_issues:                  |       Upstream:  N/A        
   Reviewer:                  |         Author:             
     Merged:                  |   Dependencies:             
------------------------------+---------------------------------------------
Changes (by mjo):

 * cc: mjo (added)


Comment:

 This looks like a stacklevel mismatch between python and cython code. Some
 other examples in pure python:

 {{{
 sage: numerical_sqrt(3)
 /home/mjo/src/sage-5.0.beta1/local/bin/sage-ipython:1: DeprecationWarning:
 numerical_sqrt is deprecated, use sqrt(x, prec=n) instead
   #!/usr/bin/env python
 sqrt(3)
 }}}

 {{{
 sage: Polyhedron(vertices=[[0]]).union( Polyhedron(vertices=[[1]]) )
 /home/mjo/src/sage-5.0.beta1/local/bin/sage-ipython:1: DeprecationWarning:
 (Since Sage Version 4.4.4) The function union is replaced by convex_hull.
   #!/usr/bin/env python
 A 1-dimensional polyhedron in QQ^1 defined as the convex hull of 2
 vertices.
 }}}

 If we pick something in a `*.pyx` file,

 {{{
 sage: p = m.copy()
 /home/mjo/src/sage-5.0.beta1/local/lib/python2.7/site-
 packages/IPython/iplib.py:2260: DeprecationWarning: the .copy() method is
 deprecated; please use the copy() function instead, for example, copy(M)
   exec code_obj in self.user_global_ns, self.user_ns
 }}}

 {{{
 sage: x.lgamma()
 /home/mjo/src/sage-5.0.beta1/local/lib/python2.7/site-
 packages/IPython/iplib.py:2260: DeprecationWarning: The lgamma() function
 is deprecated. Use log_gamma() instead.
   exec code_obj in self.user_global_ns, self.user_ns
 log_gamma(x)
 }}}


 (notice the iplib.py/sage-ipython difference). In a python file, the
 stacklevel of EllipticCurve seems to be correct while the one for e.g.
 lgamma() is off by one. Here's a test.py file:

 {{{
 from sage.all import *

 print "Calling EllipticCurve..."
 EllipticCurve(ZZ(1))

 print "\nCalling x.lgamma()"
 var('x').lgamma()
 }}}

 And running it:

 {{{
 $ sage test.py
 Calling EllipticCurve...
 test.py:4: DeprecationWarning: 'EllipticCurve(j)' is deprecated; use
 'EllipticCurve_from_j(j)' or 'EllipticCurve(j=j)' instead.
   EllipticCurve(ZZ(1))

 Calling x.lgamma()
 sys:1: DeprecationWarning: The lgamma() function is deprecated. Use
 log_gamma() instead.
 }}}

 Adjusting the stacklevel fixes one, but breaks the other.

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