diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2017-03-21 15:34:35 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-21 15:34:35 -0600 |
commit | 0dd7ca5d57f216d14f70c28694a15fb909ee645e (patch) | |
tree | f4d6ee365002d23371bc2bcd8aff23197bfa27a5 /numpy/lib/polynomial.py | |
parent | 71a12bdd037de1f1c2d016d373982c27f6f58110 (diff) | |
parent | 0ea21d1092c9154d72d50b04ba2c8025704c679f (diff) | |
download | numpy-0dd7ca5d57f216d14f70c28694a15fb909ee645e.tar.gz |
Merge pull request #8788 from eric-wieser/poly1d-fixes-fixes
BUG: Fix scipy incompatibility with cleanup to poly1d
Diffstat (limited to 'numpy/lib/polynomial.py')
-rw-r--r-- | numpy/lib/polynomial.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index 50e6d8db2..e18bbc8bc 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -1041,7 +1041,7 @@ class poly1d(object): @property def coeffs(self): """ The polynomial coefficients """ - return self._coeffs + return self._coeffs.copy() @property def variable(self): @@ -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 |