python_api: reduce scope of a `except BaseException` in ApproxNumpy
I'm not sure if it can even raise at all, but catching BaseException would swallow ctrl-C and such and is definitely inappropriate here.
This commit is contained in:
parent
23c9856857
commit
645aaa728d
|
@ -123,8 +123,10 @@ class ApproxNumpy(ApproxBase):
|
|||
if not np.isscalar(actual):
|
||||
try:
|
||||
actual = np.asarray(actual)
|
||||
except BaseException:
|
||||
raise TypeError("cannot compare '{}' to numpy.ndarray".format(actual))
|
||||
except Exception as e:
|
||||
raise TypeError(
|
||||
"cannot compare '{}' to numpy.ndarray".format(actual)
|
||||
) from e
|
||||
|
||||
if not np.isscalar(actual) and actual.shape != self.expected.shape:
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue