cannot access masked array rows with np.object dtype (Fixes #2432) #2747

Merged
merged 2 commits into from Dec 8, 2012

Conversation

Projects
None yet
3 participants
Contributor

mdboom commented Nov 15, 2012

In the astropy project we've run into bug #2432. (See astropy/astropy#465).

This bug is made more prominent the recent commit 7caac2e, since mvoid arrays are created in all cases, not just when there are masked elements.

The fix here is just to use the Numpy array constructor instead of itemwise assignment, which does handle object fields correctly.

Hope this makes sense -- I can't say I'm an expert on the masked array code.

@mdboom mdboom Fixes #2432. Rather than creating a new data array and assigning to i…
…t (which doesn't work when it is a recarray containing object fields), just create a copy with the np.array constructor.
0196aed

mdboom referenced this pull request in astropy/astropy Nov 15, 2012

Closed

Failing test_from_scratch_example in vo_test.py #465

Owner

njsmith commented Nov 20, 2012

Needs a test.

Contributor

mdboom commented Dec 3, 2012

Test added.

Contributor

astrofrog commented Dec 7, 2012

@njsmith - would it be possible for this PR to be merged in the near future? The reason I ask is that we are finalizing issues for a release of astropy (http://www.astropy.org), and it would be useful to know if this fix will be included, or whether we will have to add a workaround to our code. Thanks!

Owner

njsmith commented Dec 7, 2012

Looks fine to me -- anyone more familiar with the masked array code want to chime in?

Also if I'm reading the history here right, you're only worried about this for 1.8, right, and 1.7 is fine as-is?

Contributor

astrofrog commented Dec 8, 2012

@njsmith - it depends whether 7caac2e will make 1.7, or if it will only be included in 1.8. If 7caac2e is not in 1.7, then yes we are only worried for 1.8.

Owner

njsmith commented Dec 8, 2012

7caac2e is #483, right? That PR isn't backported to 1.7, so I guess this one shouldn't be either.

And if we're not backporting to 1.7 then I'm less worried about getting review on this since 1.8 will have its own rounds of RCs, so, merging.

@njsmith njsmith added a commit that referenced this pull request Dec 8, 2012

@njsmith njsmith Merge pull request #2747 from mdboom/fix-masked-recarrays-with-objects
cannot access masked array rows with np.object dtype (Fixes #2432)
686bcfd

@njsmith njsmith merged commit 686bcfd into numpy:master Dec 8, 2012

1 check passed

default The Travis build passed
Details
Contributor

astrofrog commented Dec 8, 2012

@njsmith - yes, that's the right pull request. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment