summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2019-05-12 09:27:12 -0700
committerGitHub <noreply@github.com>2019-05-12 09:27:12 -0700
commitd2d589703d5ee743251fbc6ea045f28e1c5e9e71 (patch)
treedf60e9574f8a2af7ad29cfbde2ad68b8a2ed405a /numpy/ma/core.py
parent798dce7d2f4d661eef2604bbd68fbe068c8d1ad6 (diff)
parent599dbade766ad3fecc82afa308803a2e0082c149 (diff)
downloadnumpy-d2d589703d5ee743251fbc6ea045f28e1c5e9e71.tar.gz
Merge pull request #10308 from eric-wieser/mask-attr-is-view
API: Make MaskedArray.mask return a view, rather than the underlying mask
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 7ed099722..93eb4d87a 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -3449,7 +3449,9 @@ class MaskedArray(ndarray):
# We could try to force a reshape, but that wouldn't work in some
# cases.
- return self._mask
+ # Return a view so that the dtype and shape cannot be changed in place
+ # This still preserves nomask by identity
+ return self._mask.view()
@mask.setter
def mask(self, value):