diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 93eb4d87af2b..d61d06d386d7 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -5870,7 +5870,6 @@ def take(self, indices, axis=None, out=None, mode='raise'): return out[()] # Array methods - clip = _arraymethod('clip', onmask=False) copy = _arraymethod('copy') diagonal = _arraymethod('diagonal') flatten = _arraymethod('flatten') diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index fb3f1a810807..cf11b6096318 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -3035,6 +3035,13 @@ def test_clip(self): assert_equal(clipped._data, x.clip(2, 8)) assert_equal(clipped._data, mx._data.clip(2, 8)) + def test_clip_out(self): + # gh-14140 + a = np.arange(10) + m = np.ma.MaskedArray(a, mask=[0, 1] * 5) + m.clip(0, 5, out=m) + assert_equal(m.mask, [0, 1] * 5) + def test_compress(self): # test compress a = masked_array([1., 2., 3., 4., 5.], fill_value=9999)