Repository: numpy/numpy

Issue:
Inconsistency of np.clip with MaskedArray when using output argument
### Reproducing code example:

```python
In [1]: import numpy as np                                                                                                                                                 

In [2]: np.__version__                                                                                                                                                     
Out[2]: '1.17.0'

In [3]: a = np.arange(10)                                                                                                                                                  

In [4]: m = np.ma.MaskedArray(a, mask=[0, 1] * 5)                                                                                                                          

In [5]: np.clip(m, 0, 5)                                                                                                                                                   
Out[5]: 
masked_array(data=[0, --, 2, --, 4, --, 5, --, 5, --],
             mask=[False,  True, False,  True, False,  True, False,  True,
                   False,  True],
       fill_value=999999)

In [6]: m                                                                                                                                                                  
Out[6]: 
masked_array(data=[0, --, 2, --, 4, --, 6, --, 8, --],
             mask=[False,  True, False,  True, False,  True, False,  True,
                   False,  True],
       fill_value=999999)

In [7]: np.clip(m, 0, 5, m)                                                                                                                                                
Out[7]: 
masked_array(data=[0, 1, 2, 3, 4, 5, 5, 5, 5, 5],
             mask=False,
       fill_value=999999)

In [8]: m                                                                                                                                                                  
Out[8]: 
masked_array(data=[0, 1, 2, 3, 4, 5, 5, 5, 5, 5],
             mask=False,
       fill_value=999999)
```

### Error message:

Inconsistency of `np.clip` with `MaskedArray` when using output argument. I.e.:

```python
np.clip(m, 0, 5)
np.clip(m, 0, 5, m)
```

these two lines produce different results.

### Numpy/Python version information:

Python: 3.7.3
Numpy: 1.17.0




Discussion:
fallout from #12519. Easy workaround for 1.17.0 is
```python
del np.ma.MaskedArray.clip
```
Fix will be to remove the definition of the method, the one inherited from ndarray works correctly.

Resolving patch:
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
--- 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')


Test patch:
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
--- 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)