提交 7d42c60d authored 作者: Frederic Bastien's avatar Frederic Bastien

Don't catch interup in try except.

上级 6a0b74bc
......@@ -152,7 +152,7 @@ class BadCLinkerOutput(DebugModeError):
print >> ssio, numpy.isnan(self.val_py).sum(),
# only if all succeeds to we add anything to sio
print >> sio, ssio.getvalue()
except:
except Exception:
pass
try:
ssio = StringIO()
......@@ -166,7 +166,7 @@ class BadCLinkerOutput(DebugModeError):
print >> ssio, numpy.isnan(self.val_c).sum(),
# only if all succeeds to we add anything to sio
print >> sio, ssio.getvalue()
except:
except Exception:
pass
try:
ov=numpy.asarray(self.val_c)
......@@ -184,7 +184,7 @@ class BadCLinkerOutput(DebugModeError):
print >> ssio, " Std Rel Diff: ", numpy.std(reldiff)
# only if all succeeds to we add anything to sio
print >> sio, ssio.getvalue()
except:
except Exception:
pass
return sio.getvalue()
......@@ -246,7 +246,7 @@ class BadOptimization(DebugModeError):
print >> ssio, self.old_r_val.strides
# only if all succeeds to we add anything to sio
print >> sio, ssio.getvalue()
except:
except Exception:
pass
str_old_r_val = str(self.old_r_val)
......@@ -263,7 +263,7 @@ class BadOptimization(DebugModeError):
print >> ssio, self.new_r_val.strides
# only if all succeeds to we add anything to sio
print >> sio, ssio.getvalue()
except:
except Exception:
pass
str_new_r_val = str(self.new_r_val)
if len(str_new_r_val) > val_str_len_limit:
......@@ -286,7 +286,7 @@ class BadOptimization(DebugModeError):
print >> ssio, " Std Rel Diff: ", numpy.std(reldiff)
# only if all succeeds to we add anything to sio
print >> sio, ssio.getvalue()
except:
except Exception:
pass
print >> sio, " Reason: ", str(self.reason)
......@@ -400,7 +400,7 @@ class InvalidValueError(DebugModeError):
v_min = v.min()
v_max = v.max()
v_isfinite = numpy.all(numpy.isfinite(v))
except:
except Exception:
pass
client_node = self.client_node
hint = self.hint
......@@ -687,7 +687,7 @@ def _check_strides_match(a, b, warn_err, op):
try:
strides_eq = a.strides == b.strides
except:
except Exception:
return # no strides
if not strides_eq:
......@@ -1435,7 +1435,7 @@ class _Linker(gof.link.LocalLinker):
## First time, with None in output_storage
try:
thunk_c()
except:
except Exception:
raise_with_op(node)
for r in node.outputs:
......@@ -1475,7 +1475,7 @@ class _Linker(gof.link.LocalLinker):
def thunk():
try:
thunk_c()
except:
except Exception:
raise_with_op(node)
_logger.debug(
'%i - calling _check_preallocated_output '
......@@ -1547,7 +1547,7 @@ class _Linker(gof.link.LocalLinker):
storage_map[r][0].itemset(dr_vals[r][0])
else:
storage_map[r][0] = dr_vals[r][0]
except:
except Exception:
# Restore the initial state of storage_map
for r in storage_map:
if r in original_storage_map_keys:
......
......@@ -597,7 +597,7 @@ class Function(object):
t0_fn = time.time()
try:
self.fn()
except:
except Exception:
if hasattr(self.fn, 'position_of_error'):
# this is a new vm-provided function
# the C VM needs this because the exception manipulation
......@@ -1107,7 +1107,7 @@ try:
# compatible with python 2.4, we implement pickling of slice
# ourself.
cPickle.dumps(slice(0, 10, 100))
except:
except TypeError:
# This slice pickle implementation seam backward and forward compatible.
def _pickle_slice(s):
return (slice, (s.start, s.stop, s.step))
......@@ -1120,7 +1120,7 @@ def check_equal(x, y):
for checker in __checkers:
try:
return checker(x, y)
except:
except Exception:
continue
return x == y
#raise Exception('No checker for equality between %s and %s' % (x, y))
......
......@@ -1120,7 +1120,7 @@ class Module(ComponentDict):
self[k] = self.__wrapper__(recurse(v))
try:
self[k] = self.__wrapper__(v)
except:
except Exception:
if isinstance(v, Component):
raise
else:
......
......@@ -143,7 +143,7 @@ def rebuild_collect_shared( outputs
replace = []
try:
replace_pairs = replace.items()
except:
except Exception:
replace_pairs = replace
for v_orig, v_repl in replace_pairs:
......
......@@ -472,7 +472,7 @@ class T_module(unittest.TestCase):
m = M.make()
try:
m.y = 77 #fail?
except:
except Exception:
pass
assert m.y == 40
assert m.f(20) == 100
......
......@@ -461,7 +461,7 @@ def pydotprint(fct, outfile=None,
try:
import pydot as pd
except:
except ImportError:
print "failed to import pydot. Yous must install pydot for this function to work."
return
......
......@@ -593,7 +593,7 @@ class unary_out_lookup(gof.utils.object2):
types = types[0]
try:
rval = self.tbl[types]
except:
except Exception:
raise TypeError(types)
if isinstance(types, (list, tuple)):
return rval
......
......@@ -249,7 +249,7 @@ def isNaN_or_Inf_or_None(x):
isNaN = numpy.isnan(x)
isInf = numpy.isinf(x)
isStr = isinstance(x, str)
except:
except Exception:
isNaN = False
isInf = False
isStr = False
......@@ -258,7 +258,7 @@ def isNaN_or_Inf_or_None(x):
val = get_constant_value(x)
isInf = numpy.isinf(val)
isNaN = numpy.isnan(val)
except:
except Exception:
isNaN = False
isInf = False
if isinstance(x, gof.Constant) and isinstance(x.data, str):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论