diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-03-09 02:57:18 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-03-09 02:57:18 +0000 |
commit | 18b7cd9df7a4d960550b18faa14d5473e7d5c3d9 (patch) | |
tree | a6e1cbeda9b501c2b29121c0b9ca9fa94c95b4bf /numpy/lib/polynomial.py | |
parent | 6a3edf3210b439a4d1a51acb4e01bac017697ee6 (diff) | |
download | numpy-18b7cd9df7a4d960550b18faa14d5473e7d5c3d9.tar.gz |
BUG: Prevent crash in poly1d.__eq__
Fixes #8760
Diffstat (limited to 'numpy/lib/polynomial.py')
-rw-r--r-- | numpy/lib/polynomial.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index f00d95b6c..6c0c11ac6 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -1199,11 +1199,15 @@ class poly1d(object): __rtruediv__ = __rdiv__ def __eq__(self, other): + if not isinstance(other, poly1d): + return NotImplemented if self.coeffs.shape != other.coeffs.shape: return False return (self.coeffs == other.coeffs).all() def __ne__(self, other): + if not isinstance(other, poly1d): + return NotImplemented return not self.__eq__(other) def __setattr__(self, key, val): |