summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2019-07-28 14:55:13 -0700
committerEric Wieser <wieser.eric@gmail.com>2019-07-28 16:36:32 -0700
commit4e68aba658a6e54d09150f093cdb6f9d4883b081 (patch)
treeba7d584a359b6790493c455666a97e1c13c14fd7
parent75ea05fc0af60c685e6c071dae1f04c489a3ce93 (diff)
downloadnumpy-4e68aba658a6e54d09150f093cdb6f9d4883b081.tar.gz
BUG: Remove the broken clip wrapper
ndarray.clip is already just a wrapper for the ufunc, so there is no need to do type-specific wrapping here any more Fixes gh-14140
-rw-r--r--numpy/ma/core.py1
-rw-r--r--numpy/ma/tests/test_core.py7
2 files changed, 7 insertions, 1 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 93eb4d87a..d61d06d38 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -5870,7 +5870,6 @@ class MaskedArray(ndarray):
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 fb3f1a810..cf11b6096 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -3035,6 +3035,13 @@ class TestMaskedArrayMethods(object):
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)