Opened 8 years ago
Closed 8 years ago
#14028 closed defect (fixed)
Fix "except:" statements
Reported by: | jdemeyer | Owned by: | jason |
---|---|---|---|
Priority: | critical | Milestone: | sage-5.7 |
Component: | misc | Keywords: | |
Cc: | Merged in: | sage-5.7.beta2 | |
Authors: | Jeroen Demeyer | Reviewers: | Volker Braun |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
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
!)
Attachments (2)
Change History (11)
comment:1 Changed 8 years ago by
- Description modified (diff)
comment:2 Changed 8 years ago by
- Description modified (diff)
- Summary changed from Fix bare "except:" statements to Fix "except:" statements
comment:3 Changed 8 years ago by
- Description modified (diff)
comment:4 follow-up: ↓ 5 Changed 8 years ago by
comment:5 in reply to: ↑ 4 Changed 8 years ago by
Replying to vbraun:
Its pretty much a no-brainer. Ready for review?
Not sure. The following is fairly reproducible when interrupting GAP:
Interrupting Gap... Exception RuntimeError: RuntimeError('maximum recursion depth exceeded while calling a Python object',) in ignored Exception RuntimeError: RuntimeError('maximum recursion depth exceeded while calling a Python object',) in ignored Exception RuntimeError: RuntimeError('maximum recursion depth exceeded while calling a Python object',) in ignored [...ad infinitum...]
The backtrace at this point (thanks to #14029) is attached.
Changed 8 years ago by
comment:6 Changed 8 years ago by
The problem was removing the statement
self._session_number = -1
New patch attached which should fix this. I also changed a few more instances of
except StandardError:
to
except BaseException:
in cases where the except-clause was doing cleanup + re-raise.
Changed 8 years ago by
comment:7 Changed 8 years ago by
- Status changed from new to needs_review
Passes all long doctests, so ready for review.
comment:8 Changed 8 years ago by
- Reviewers set to Volker Braun
- Status changed from needs_review to positive_review
Looks good to me.
comment:9 Changed 8 years ago by
- Merged in set to sage-5.7.beta2
- Resolution set to fixed
- Status changed from positive_review to closed
Its pretty much a no-brainer. Ready for review?