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.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 5ed086db3..091ab4e20 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -2319,8 +2319,10 @@ def masked_values(x, value, rtol=1e-5, atol=1e-8, copy=True, shrink=True):
mask = np.isclose(xnew, value, atol=atol, rtol=rtol)
else:
mask = umath.equal(xnew, value)
- return masked_array(
- xnew, mask=mask, copy=copy, fill_value=value, shrink=shrink)
+ ret = masked_array(xnew, mask=mask, copy=copy, fill_value=value)
+ if shrink:
+ ret.shrink_mask()
+ return ret
def masked_invalid(a, copy=True):