summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index fb28fa8e5..ba0d58577 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -2999,12 +2999,15 @@ class MaskedArray(ndarray):
order = "K"
_mask = _mask.astype(_mask_dtype, order)
-
+ else:
+ # Take a view so shape changes, etc., do not propagate back.
+ _mask = _mask.view()
else:
_mask = nomask
self._mask = _mask
# Finalize the mask
+ # FIXME: this really doesn't belong here.
if self._mask is not nomask:
try:
self._mask.shape = self.shape
@@ -3354,6 +3357,8 @@ class MaskedArray(ndarray):
self._mask.shape = self.shape
except (AttributeError, TypeError):
pass
+ elif attr == 'shape' and getmask(self) is not nomask:
+ self._mask.shape = self.shape
def __setmask__(self, mask, copy=False):
"""