diff options
author | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2015-06-12 12:49:31 -0400 |
---|---|---|
committer | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2015-06-17 22:17:04 -0400 |
commit | 1a4d94357eb8d06930ad69309fda579a8caa6c57 (patch) | |
tree | 3fbaa752070c48a1972acf8ac857db35cea0e217 /numpy/doc/indexing.py | |
parent | a580d6fb832ee1c571a60b104e44b6b21f3c2951 (diff) | |
download | numpy-1a4d94357eb8d06930ad69309fda579a8caa6c57.tar.gz |
BUG Ensure masked object arrays can always return single items.
For a masked array holding objects that themselves are arrays, when selecting a
single item, it is treated as if it were a slice of the array and an attempt is
made to set its mask. This was always a bug, but it become visible with a
recent change to `MaskedArray.__getitem__` (gh-4586) where it is attempted to
change the shape of the mask. With this PR, this case gets special treatment
in that the object is made into a Masked Array with a full set mask.
(A previous attempt to do the perhaps more logical think and just return
`masked` caused quite a few errors in astropy.io.votable; it seemed it was
not worth breaking backwards compatibility that much).
Test case that now works but used to fail:
```
mx1 = MaskedArray([1.], mask=[True])
mx2 = MaskedArray([1., 2.])
mx = MaskedArray([mx1, mx2], mask=[False, True])
mx[0]
```
Diffstat (limited to 'numpy/doc/indexing.py')
0 files changed, 0 insertions, 0 deletions