diff options
Diffstat (limited to 'numpy/ma/core.py')
| -rw-r--r-- | numpy/ma/core.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index be213ebf3..59ba3a593 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -2835,7 +2835,6 @@ class MaskedArray(ndarray): # Process mask. # Type of the mask mdtype = make_mask_descr(_data.dtype) - if mask is nomask: # Case 1. : no mask in input. # Erase the current mask ? @@ -2870,6 +2869,12 @@ class MaskedArray(ndarray): else: # Case 2. : With a mask in input. # If mask is boolean, create an array of True or False + + # if users pass `mask=None` be forgiving here and cast it False + # for speed; although the default is `mask=nomask` and can differ. + if mask is None: + mask = False + if mask is True and mdtype == MaskType: mask = np.ones(_data.shape, dtype=mdtype) elif mask is False and mdtype == MaskType: @@ -2917,6 +2922,7 @@ class MaskedArray(ndarray): else: _data._mask = np.logical_or(mask, _data._mask) _data._sharedmask = False + # Update fill_value. if fill_value is None: fill_value = getattr(data, '_fill_value', None) |
