summaryrefslogtreecommitdiff
path: root/numpy/ma
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-05-18 23:12:08 -0700
committerEric Wieser <wieser.eric@gmail.com>2018-05-18 23:12:08 -0700
commit7078ec63b55088d353b148f9c2d062ea879af2db (patch)
tree951ca7db22041247a189dad22df70e39e631fbcb /numpy/ma
parent15f19c4058978ec30721d1295e093e4f53c5a6b9 (diff)
downloadnumpy-7078ec63b55088d353b148f9c2d062ea879af2db.tar.gz
MAINT: remove redundant code in MaskedArray.__new__
Diffstat (limited to 'numpy/ma')
-rw-r--r--numpy/ma/core.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index fb28fa8e5..d5ef4461d 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -2799,13 +2799,8 @@ class MaskedArray(ndarray):
# FIXME _sharedmask is never used.
_sharedmask = True
# Process mask.
- # Number of named fields (or zero if none)
- names_ = _data.dtype.names or ()
# Type of the mask
- if names_:
- mdtype = make_mask_descr(_data.dtype)
- else:
- mdtype = MaskType
+ mdtype = make_mask_descr(_data.dtype)
if mask is nomask:
# Case 1. : no mask in input.
@@ -2831,14 +2826,12 @@ class MaskedArray(ndarray):
_data._mask = mask
_data._sharedmask = False
else:
+ _data._sharedmask = not copy
if copy:
_data._mask = _data._mask.copy()
- _data._sharedmask = False
# Reset the shape of the original mask
if getmask(data) is not nomask:
data._mask.shape = data.shape
- else:
- _data._sharedmask = True
else:
# Case 2. : With a mask in input.
# If mask is boolean, create an array of True or False
@@ -2875,7 +2868,7 @@ class MaskedArray(ndarray):
_data._mask = mask
_data._sharedmask = not copy
else:
- if names_:
+ if _data.dtype.names:
def _recursive_or(a, b):
"do a|=b on each field of a, recursively"
for name in a.dtype.names:
@@ -2884,7 +2877,6 @@ class MaskedArray(ndarray):
_recursive_or(af, bf)
else:
af |= bf
- return
_recursive_or(_data._mask, mask)
else:
_data._mask = np.logical_or(mask, _data._mask)