summaryrefslogtreecommitdiff
path: root/numpy/lib/polynomial.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-03-09 02:57:18 +0000
committerEric Wieser <wieser.eric@gmail.com>2017-03-09 02:57:18 +0000
commit18b7cd9df7a4d960550b18faa14d5473e7d5c3d9 (patch)
treea6e1cbeda9b501c2b29121c0b9ca9fa94c95b4bf /numpy/lib/polynomial.py
parent6a3edf3210b439a4d1a51acb4e01bac017697ee6 (diff)
downloadnumpy-18b7cd9df7a4d960550b18faa14d5473e7d5c3d9.tar.gz
BUG: Prevent crash in poly1d.__eq__
Fixes #8760
Diffstat (limited to 'numpy/lib/polynomial.py')
-rw-r--r--numpy/lib/polynomial.py4
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):