[Numpy-discussion] Polynomial silent breakage with 1.13

Matthew Brett matthew.brett at gmail.com
Fri Jul 7 12:26:56 EDT 2017


Our (nipy's) test suite just failed with the upgrade to numpy 1.13,
and the cause boiled down to this:

import numpy as np

poly = np.poly1d([1])
poly.c[0] *= 2

Numpy 1.12 gives (to me) expected output:


Numpy 1.13 gives (to me) unexpected output:


The problem is caused by the fact that the coefficients are now a
*copy* of the actual coefficient array - I think in an attempt to stop
us modifying the coefficients directly.

I can't see any deprecation warnings with `-W always`.

The pain point here is that code that used to give the right answer
has now (I believe silently) switched to giving the wrong answer.



More information about the NumPy-Discussion mailing list