diff options
author | John Kirkham <kirkhamj@janelia.hhmi.org> | 2017-01-17 09:45:03 -0500 |
---|---|---|
committer | John Kirkham <kirkhamj@janelia.hhmi.org> | 2017-01-17 09:45:03 -0500 |
commit | 50ebc7a8a78c0c774682f87a29327c111366afb1 (patch) | |
tree | e4a55e73f4ba493f4297d15e3c01e633bd9a90dd /numpy/ma | |
parent | 305c302e0e5a877f81fcaf9ef00a289528f8466e (diff) | |
download | numpy-50ebc7a8a78c0c774682f87a29327c111366afb1.tar.gz |
BUG: Share masked array views for writing.
Diffstat (limited to 'numpy/ma')
-rw-r--r-- | numpy/ma/core.py | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 4466dc0af..20515c827 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -3259,8 +3259,6 @@ class MaskedArray(ndarray): _mask[indx] = tuple([True] * nbfields) else: _mask[indx] = True - if not self._isfield: - self._sharedmask = False return # Get the _data part of the new value @@ -3276,27 +3274,6 @@ class MaskedArray(ndarray): _mask = self._mask = make_mask_none(self.shape, _dtype) _mask[indx] = mval elif not self._hardmask: - # Unshare the mask if necessary to avoid propagation - # We want to remove the unshare logic from this place in the - # future. Note that _sharedmask has lots of false positives. - if not self._isfield: - notthree = getattr(sys, 'getrefcount', False) and (sys.getrefcount(_mask) != 3) - if self._sharedmask and not ( - # If no one else holds a reference (we have two - # references (_mask and self._mask) -- add one for - # getrefcount) and the array owns its own data - # copying the mask should do nothing. - (not notthree) and _mask.flags.owndata): - # 2016.01.15 -- v1.11.0 - warnings.warn( - "setting an item on a masked array which has a shared " - "mask will not copy the mask and also change the " - "original mask array in the future.\n" - "Check the NumPy 1.11 release notes for more " - "information.", - MaskedArrayFutureWarning, stacklevel=2) - self.unshare_mask() - _mask = self._mask # Set the data, then the mask _data[indx] = dval _mask[indx] = mval @@ -4575,7 +4552,7 @@ class MaskedArray(ndarray): if self._mask is nomask and getmask(values) is nomask: return - m = getmaskarray(self).copy() + m = getmaskarray(self) if getmask(values) is nomask: m.put(indices, False, mode=mode) |