Skip to content

Commit

Permalink
Merge pull request #509 from albertz/patch-1
Browse files Browse the repository at this point in the history
do not catch system exceptions like KeyboardInterrupt
  • Loading branch information
minrk authored Apr 5, 2019
2 parents 7b48947 + 6139473 commit 3eea7fc
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions traitlets/traitlets.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
try:
from types import ClassType, InstanceType
ClassTypes = (ClassType, type)
except:
except Exception:
ClassTypes = (type,)
from warnings import warn, warn_explicit

Expand Down Expand Up @@ -564,7 +564,7 @@ def set(self, obj, value):
obj._trait_values[self.name] = new_value
try:
silent = bool(old_value == new_value)
except:
except Exception:
# if there is an error in comparing, default to notify
silent = False
if silent is not True:
Expand Down Expand Up @@ -1730,7 +1730,7 @@ def validate(self, obj, value):
try:
if issubclass(value, self.klass):
return value
except:
except Exception:
pass

self.error(obj, value)
Expand Down Expand Up @@ -2026,7 +2026,7 @@ class CInt(Int):
def validate(self, obj, value):
try:
value = int(value)
except:
except Exception:
self.error(obj, value)
return _validate_bounds(self, obj, value)

Expand Down Expand Up @@ -2063,7 +2063,7 @@ class CLong(Long):
def validate(self, obj, value):
try:
value = long(value)
except:
except Exception:
self.error(obj, value)
return _validate_bounds(self, obj, value)

Expand Down Expand Up @@ -2132,7 +2132,7 @@ class CFloat(Float):
def validate(self, obj, value):
try:
value = float(value)
except:
except Exception:
self.error(obj, value)
return _validate_bounds(self, obj, value)

Expand All @@ -2157,7 +2157,7 @@ class CComplex(Complex):
def validate (self, obj, value):
try:
return complex(value)
except:
except Exception:
self.error(obj, value)

# We should always be explicit about whether we're using bytes or unicode, both
Expand All @@ -2181,7 +2181,7 @@ class CBytes(Bytes):
def validate(self, obj, value):
try:
return bytes(value)
except:
except Exception:
self.error(obj, value)


Expand Down Expand Up @@ -2209,7 +2209,7 @@ class CUnicode(Unicode):
def validate(self, obj, value):
try:
return six.text_type(value)
except:
except Exception:
self.error(obj, value)


Expand Down Expand Up @@ -2268,7 +2268,7 @@ class CBool(Bool):
def validate(self, obj, value):
try:
return bool(value)
except:
except Exception:
self.error(obj, value)


Expand Down Expand Up @@ -2892,7 +2892,7 @@ class CRegExp(TraitType):
def validate(self, obj, value):
try:
return re.compile(value)
except:
except Exception:
self.error(obj, value)


Expand Down

0 comments on commit 3eea7fc

Please sign in to comment.