summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorSimon Conseil <contact@saimon.org>2015-12-01 22:07:27 +0100
committerSimon Conseil <contact@saimon.org>2015-12-01 22:07:27 +0100
commit70d8cf55339eca151ad0896526f2e0815dba1489 (patch)
tree5541fe3419816e3c895e67623432b5f5401a3e67 /numpy
parent531f2ad34d006585281b9416fa30992dd37cf2af (diff)
downloadnumpy-70d8cf55339eca151ad0896526f2e0815dba1489.tar.gz
Test that the mask dtype if MaskType before using np.zeros/ones
Diffstat (limited to 'numpy')
-rw-r--r--numpy/ma/core.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 75c7c001e..807b28c5b 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -2757,9 +2757,9 @@ class MaskedArray(ndarray):
else:
# Case 2. : With a mask in input.
# If mask is boolean, create an array of True or False
- if mask is True:
+ if mask is True and mdtype == MaskType:
mask = np.ones(_data.shape, dtype=mdtype)
- elif mask is False:
+ elif mask is False and mdtype == MaskType:
mask = np.zeros(_data.shape, dtype=mdtype)
else:
# Read the mask with the current mdtype