diff options
author | Thomas Robitaille <thomas.robitaille@gmail.com> | 2012-10-11 14:00:02 -0400 |
---|---|---|
committer | Thomas Robitaille <thomas.robitaille@gmail.com> | 2012-10-11 14:03:25 -0400 |
commit | 7caac2efd9b2c9ccf4b886fc6273c9ebbcd6c9da (patch) | |
tree | d4a9878daf0bd86686538d560f97919fb227b604 | |
parent | fe6f42c427239d36579723085cc5207cedd8dcd1 (diff) | |
download | numpy-7caac2efd9b2c9ccf4b886fc6273c9ebbcd6c9da.tar.gz |
When accessing MaskedArray rows, always return an mvoid object
-rw-r--r-- | numpy/ma/core.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index a6f252067..a7e04cd13 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -2948,12 +2948,10 @@ class MaskedArray(ndarray): # A record ................ if isinstance(dout, np.void): mask = _mask[indx] -# If we can make mvoid a subclass of np.void, that'd be what we'd need -# return mvoid(dout, mask=mask) - if flatten_mask(mask).any(): - dout = mvoid(dout, mask=mask) - else: - return dout + # We should always re-cast to mvoid, otherwise users can + # change masks on rows that already have masked values, but not + # on rows that have no masked values, which is inconsistent. + dout = mvoid(dout, mask=mask) # Just a scalar............ elif _mask is not nomask and _mask[indx]: return masked |