#10774: RuntimeError message for numerical infinite loop is printed, not thrown
-------------------------+--------------------------------------------------
   Reporter:  niles      |       Owner:  jason, jkantor                       
       Type:  defect     |      Status:  new                                  
   Priority:  major      |   Milestone:                                       
  Component:  numerical  |    Keywords:  RuntimeError numerics recursion-depth
     Author:             |    Upstream:  N/A                                  
   Reviewer:             |      Merged:                                       
Work_issues:             |  
-------------------------+--------------------------------------------------

Comment(by nbruin):

 This is probably a python exception that occurs in a cython routine that
 does have any means to report the exception (see
 http://docs.cython.org/src/userguide/language_basics.html ) further up.
 This example illustrates the behaviour:

 {{{
 %cython
 def error_raiser():
     raise RuntimeError, "my error"

 cdef int unreportable_error_producer():
     error_raiser()
     return 1

 cdef int reportable_error_producer() except -1:
     error_raiser()
     return 1

 def call_this(reportable=0):
     if reportable:
         return reportable_error_producer()
     else:
         return unreportable_error_producer()
 }}}
 which results in
 {{{
 sage: call_this(reportable=1)
 Traceback (most recent call last):
 ...
 RuntimeError: my error
 sage: call_this()
 Exception RuntimeError: 'my error' in '[...]unreportable_error_producer'
 ignored
 0
 }}}
 The 0 return value there is rather arbitrary, I assume.

 You can investigate the errors that arise a little easier by calling:
 {{{
 sys.setrecursionlimit(100)
 N(log(NaN))
 log(arcsin(e)).n()
 }}}
 The traceback clearly shows a ping-pong between
 sage.rings.real_mpfr.RealNumber.log and
 sage.rings.complex_number.ComplexNumber.log so that's the real source of
 the error. It looks like a cython routine involved in creating the
 corresponding error object subsequently gets bitten by the already
 exhausted recursion depth and has no way of propagating that exception up.

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