diff options
author | Mark Wiebe <mwiebe@enthought.com> | 2011-07-28 17:07:44 -0500 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2011-08-27 07:26:48 -0600 |
commit | a6e869b70b09df9381d341ed0d2b18f88d8fe3d6 (patch) | |
tree | 928eb0fab828921e9bab1bedbc02823e0c3b639d /numpy | |
parent | 626949428752cc7d52e7f3fb3e8efbe97c3d9a21 (diff) | |
download | numpy-a6e869b70b09df9381d341ed0d2b18f88d8fe3d6.tar.gz |
BUG: ma: Fix a bug in numpy.ma hardmasks, exposed by the boolean indexing rewrite
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/mapping.c | 4 | ||||
-rw-r--r-- | numpy/ma/core.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c index cf294454d..d98f723a7 100644 --- a/numpy/core/src/multiarray/mapping.c +++ b/numpy/core/src/multiarray/mapping.c @@ -981,8 +981,8 @@ array_ass_boolean_subscript(PyArrayObject *self, if (size != PyArray_DIMS(v)[0]) { PyErr_Format(PyExc_TypeError, "NumPy boolean array indexing assignment " - "requires an input shape matching the number of True " - "values in the mask (%d) != (%d)", + "cannot assign %d input values to " + "the %d output values where the mask is true", (int)PyArray_DIMS(v)[0], (int)size); return -1; } diff --git a/numpy/ma/core.py b/numpy/ma/core.py index e2e954a97..fdd5d2705 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -3040,7 +3040,7 @@ class MaskedArray(ndarray): mindx = mask_or(_mask[indx], mval, copy=True) dindx = self._data[indx] if dindx.size > 1: - dindx[~mindx] = dval + np.copyto(dindx, dval, where=~mindx) elif mindx is nomask: dindx = dval ndarray.__setitem__(_data, indx, dindx) |