diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-06-03 13:39:13 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-06-03 16:26:59 +0100 |
commit | 25d5ef99be36378b429b8b6ccbca1eedc537c6b5 (patch) | |
tree | 8a83facc38d00c69f940690ed7571226402fe6a2 /numpy/polynomial/_polybase.py | |
parent | e5e2cf89d01d7b09631977482b11df79e8131c6d (diff) | |
download | numpy-25d5ef99be36378b429b8b6ccbca1eedc537c6b5.tar.gz |
BUG: Only propagate TypeError from where we throw it
Diffstat (limited to 'numpy/polynomial/_polybase.py')
-rw-r--r-- | numpy/polynomial/_polybase.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/numpy/polynomial/_polybase.py b/numpy/polynomial/_polybase.py index 7fde63206..96ca20836 100644 --- a/numpy/polynomial/_polybase.py +++ b/numpy/polynomial/_polybase.py @@ -307,31 +307,25 @@ class ABCPolyBase(object): return self def __add__(self, other): + othercoef = self._get_coefficients(other) try: - othercoef = self._get_coefficients(other) coef = self._add(self.coef, othercoef) - except TypeError as e: - raise e except Exception: return NotImplemented return self.__class__(coef, self.domain, self.window) def __sub__(self, other): + othercoef = self._get_coefficients(other) try: - othercoef = self._get_coefficients(other) coef = self._sub(self.coef, othercoef) - except TypeError as e: - raise e except Exception: return NotImplemented return self.__class__(coef, self.domain, self.window) def __mul__(self, other): + othercoef = self._get_coefficients(other) try: - othercoef = self._get_coefficients(other) coef = self._mul(self.coef, othercoef) - except TypeError as e: - raise e except Exception: return NotImplemented return self.__class__(coef, self.domain, self.window) @@ -362,10 +356,10 @@ class ABCPolyBase(object): return res[1] def __divmod__(self, other): + othercoef = self._get_coefficients(other) try: - othercoef = self._get_coefficients(other) quo, rem = self._div(self.coef, othercoef) - except (TypeError, ZeroDivisionError) as e: + except ZeroDivisionError as e: raise e except Exception: return NotImplemented |