#14028: Fix "except:" statements
----------------------------------+-----------------------------------------
       Reporter:  jdemeyer        |         Owner:  jason   
           Type:  defect          |        Status:  new     
       Priority:  critical        |     Milestone:  sage-5.7
      Component:  misc            |    Resolution:          
       Keywords:                  |   Work issues:          
Report Upstream:  N/A             |     Reviewers:          
        Authors:  Jeroen Demeyer  |     Merged in:          
   Dependencies:                  |      Stopgaps:          
----------------------------------+-----------------------------------------
Description changed by jdemeyer:

Old description:

> Replace
> {{{
> except:
> }}}
> by
> {{{
> except StandardError:
> }}}
> (or an other exception where it makes sense)
>
> Also fix some dubious `except KeyboardInterrupt` which caused for example
> {{{
> Interrupting Gap...
> Traceback (most recent call last):
>   File "/home/jdemeyer/slow5.py", line 11, in <module>
>     __time__=misc.cputime(); __wall__=misc.walltime(); test(); print
> "Time: CPU %.2f s, Wall: %.2f s"%(misc.cputime(__time__),
> misc.walltime(__wall__))
>   File "/home/jdemeyer/slow5.py", line 9, in test
>     assert G.order() == Gamma(n).index() / g.index()
>   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
> packages/sage/groups/matrix_gps/matrix_group.py", line 415, in order
>     return self.cardinality()
>   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
> packages/sage/groups/matrix_gps/matrix_group.py", line 398, in
> cardinality
>     g = self._gap_()
>   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
> packages/sage/groups/matrix_gps/matrix_group.py", line 228, in _gap_
>     raise NotImplementedError, "Matrix group over %s not
> implemented."%self.__R
> NotImplementedError: Matrix group over Ring of integers modulo 2 not
> implemented.
> }}}

New description:

 Replace
 {{{
 except:
 }}}
 by
 {{{
 except StandardError:
 }}}
 (or an other exception where it makes sense)

 Also fix some dubious `except KeyboardInterrupt` which caused for example
 {{{
 Interrupting Gap...
 Traceback (most recent call last):
   File "/home/jdemeyer/slow5.py", line 11, in <module>
     __time__=misc.cputime(); __wall__=misc.walltime(); test(); print
 "Time: CPU %.2f s, Wall: %.2f s"%(misc.cputime(__time__),
 misc.walltime(__wall__))
   File "/home/jdemeyer/slow5.py", line 9, in test
     assert G.order() == Gamma(n).index() / g.index()
   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
 packages/sage/groups/matrix_gps/matrix_group.py", line 415, in order
     return self.cardinality()
   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
 packages/sage/groups/matrix_gps/matrix_group.py", line 398, in cardinality
     g = self._gap_()
   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
 packages/sage/groups/matrix_gps/matrix_group.py", line 228, in _gap_
     raise NotImplementedError, "Matrix group over %s not
 implemented."%self.__R
 NotImplementedError: Matrix group over Ring of integers modulo 2 not
 implemented.
 }}}
 or
 {{{
 Interrupting Gap...
 Traceback (most recent call last):
   File "/home/jdemeyer/slow5.py", line 11, in <module>
     __time__=misc.cputime(); __wall__=misc.walltime(); test(); print
 "Time: CPU %.2f s, Wall: %.2f s"%(misc.cputime(__time__),
 misc.walltime(__wall__))
   File "/home/jdemeyer/slow5.py", line 9, in test
     assert G.order() == Gamma(n).index() / g.index()
   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
 packages/sage/groups/matrix_gps/matrix_group.py", line 415, in order
     return self.cardinality()
   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
 packages/sage/groups/matrix_gps/matrix_group.py", line 400, in cardinality
     return integer.Integer(gap(self).Size())
   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
 packages/sage/interfaces/interface.py", line 590, in __call__
     return self._obj.parent().function_call(self._name, [self._obj] +
 list(args), kwds)
   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
 packages/sage/interfaces/gap.py", line 899, in function_call
     return self.new('last')
   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
 packages/sage/interfaces/interface.py", line 266, in new
     return self(code)
   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
 packages/sage/interfaces/interface.py", line 201, in __call__
     return cls(self, x, name=name)
   File "/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
 packages/sage/interfaces/expect.py", line 1285, in __init__
     raise TypeError, x
 TypeError: Ctrl-c pressed while running Gap
 }}}
 (note the `TypeError`!)

--

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