summaryrefslogtreecommitdiff
path: root/numpy/lib/polynomial.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-03-16 01:07:35 +0000
committerEric Wieser <wieser.eric@gmail.com>2017-03-21 21:04:28 +0000
commitef6559dd63af3f6140c2011d3c02b4628c6fa766 (patch)
treedaa8858d434da7efe33575a8badc061215da7746 /numpy/lib/polynomial.py
parent6f108ae44904026d7da2a1b71abb116284b04960 (diff)
downloadnumpy-ef6559dd63af3f6140c2011d3c02b4628c6fa766.tar.gz
BUG: Fix regression in scipy that relied on quirky behaviour
Scipy needs `.__dict__['coeffs']` to work, so we can't call the member _coeffs
Diffstat (limited to 'numpy/lib/polynomial.py')
-rw-r--r--numpy/lib/polynomial.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py
index 50e6d8db2..ddff0d3b0 100644
--- a/numpy/lib/polynomial.py
+++ b/numpy/lib/polynomial.py
@@ -1059,6 +1059,16 @@ class poly1d(object):
""" The roots of the polynomial, where self(x) == 0 """
return roots(self._coeffs)
+ # our internal _coeffs property need to be backed by __dict__['coeffs'] for
+ # scipy to work correctly. Note that as a result, the getter for .coeffs
+ # does not run unless accessed through one of its aliases.
+ @property
+ def _coeffs(self):
+ return self.__dict__['coeffs']
+ @_coeffs.setter
+ def _coeffs(self, coeffs):
+ self.__dict__['coeffs'] = coeffs
+
# alias attributes
r = roots
c = coef = coefficients = coeffs