summaryrefslogtreecommitdiff
path: root/numpy/ma
diff options
context:
space:
mode:
authoriameskild <eskild@doublee.io>2021-06-11 07:03:40 -0700
committeriameskild <eskild@doublee.io>2021-06-11 07:03:40 -0700
commit25042301ae655ace524978d2aa7cd08997fd4111 (patch)
treee1daac51e15da73b823e87001758a59d928de94d /numpy/ma
parent6790873334b143117f4e8d1f515def8c7fdeb9fb (diff)
downloadnumpy-25042301ae655ace524978d2aa7cd08997fd4111.tar.gz
Add check if __setitem__ indx is ma
Diffstat (limited to 'numpy/ma')
-rw-r--r--numpy/ma/core.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 82e5e7155..cd3753745 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -3381,8 +3381,11 @@ class MaskedArray(ndarray):
_mask[indx] = mval
elif not self._hardmask:
# Set the data, then the mask
- _data[indx] = dval
- _mask[indx] = mval
+ if isinstance(indx, masked_array):
+ _data[indx.data] = dval
+ else:
+ _data[indx] = dval
+ _mask[indx] = mval
elif hasattr(indx, 'dtype') and (indx.dtype == MaskType):
indx = indx * umath.logical_not(_mask)
_data[indx] = dval