#7535: Errors should be raised, not returned.
---------------------------+------------------------------------------------
   Reporter:  SimonKing    |       Owner:  tbd         
       Type:  defect       |      Status:  new         
   Priority:  critical     |   Milestone:              
  Component:  performance  |    Keywords:  error return
Work_issues:               |      Author:              
   Upstream:  N/A          |    Reviewer:              
     Merged:               |  
---------------------------+------------------------------------------------
 The following issue was considered in at least two threads, the latest at
 [http://groups.google.com/group/sage-
 devel/browse_thread/thread/3661fde739474fdb].

 There are several places in the Sage code where errors are not raised but
 returned. A hopefully exhaustive search brought up the following:
 {{{
 sage: import exceptions
 sage: for E in dir(exceptions):
 ....:     if not E.startswith('__'):
 ....:         s = search_src("return "+E)
 ....:         if s:
 ....:             print s
 ....:
 rings/finite_field_element.py:384:                return ArithmeticError,
 "Multiplicative order of 0 not defined."
 rings/finite_field_givaro.pyx:1956:                return ArithmeticError,
 "Multiplicative order of 0 not defined."
 structure/element.pyx:2601:            return ArithmeticError,
 "Multiplicative order of 0 not defined."

 rings/ring.pyx:687:            return NotImplementedError
 modular/hecke/module.py:706:        abstract base class, return
 NotImplementedError.
 modular/arithgroup/congroup_gammaH.py:928:            return
 NotImplementedError
 geometry/polyhedra.py:1068:            return NotImplementedError
 symbolic/expression.pyx:1524:        return NotImplementedError
 symbolic/expression_conversions.py:638:            return
 NotImplementedError("SymPy function '%s' doesn't exist" % f)

 interfaces/gap.py:580:            return RuntimeError, "Error evaluating
 %s in %s"%(line, self)

 modular/abvar/finite_subgroup.py:280:            return ValueError, "self
 and other must be in the same ambient Jacobian"
 groups/perm_gps/permgroup_named.py:945:            return ValueError,
 "Degree must be 2."
 groups/perm_gps/permgroup_named.py:988:            return ValueError,
 "Degree must be 2."
 }}}

 Of course, if an error is returned it can't be catched, which implies
 obvious problems.

 I have no idea what component that ticket should be associated with.
 "Performance" seemed the least inappropriate description to me.

 Is there any of the above cases in which the error should really be
 returned, not raised?

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