numpy/numpy — pull request #3914 by mhvk (2013-10-14 02:50:24+00:00)
Title: BUG Masked arrays treated incorrectly in isclose(..,..,equal_nan=True)

Currently, the mask of a MaskedArray is incorrectly changed in the following:
```
import numpy as np; from numpy import isclose, nan
m = np.ma.MaskedArray([nan, nan], mask=[True, False])
isclose(m, m, equal_nan=True)
```
yields
```
masked_array(data = [True True],
mask = [False False],
fill_value = True)
```
The problem lies in the fact that in `isclose`, the following final assignment is done
```
cond[isnan(x) & isnan(y)] = True
```
The problem here is that the mask of the index is ignored in `__setitem__` (and it would be very hard to do otherwise), but and hence all elements are being set. Since `True` has no mask, the mask of all ements is cleared. To avoid this, this PR ensured that the vallues used include a mask, by replacing the above line with
```
both_nan = isnan(x) & isnan(y)
cond[both_nan] = both_nan[both_nan]
```
A test case is included as well.

p.s. This bug was found while trying to allow `MaskedArray` to behave better with subclasses; see #3907