Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not catch system exceptions like KeyboardInterrupt #509

Merged
merged 1 commit into from
Apr 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1725,7 +1725,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 @@ -2021,7 +2021,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 @@ -2058,7 +2058,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 @@ -2127,7 +2127,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 @@ -2152,7 +2152,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 @@ -2176,7 +2176,7 @@ class CBytes(Bytes):
def validate(self, obj, value):
try:
return bytes(value)
except:
except Exception:
self.error(obj, value)


Expand Down Expand Up @@ -2204,7 +2204,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 @@ -2263,7 +2263,7 @@ class CBool(Bool):
def validate(self, obj, value):
try:
return bool(value)
except:
except Exception:
self.error(obj, value)


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


Expand Down