Skip to content

Remove an obsolete workaround from Row.as_void() - #12601

Merged
taldcroft merged 1 commit into
astropy:mainfrom
eerovaher:rm-old-mvoid-workaround
Dec 19, 2021
Merged

taldcroft merged 1 commit into
astropy:mainfrom
eerovaher:rm-old-mvoid-workaround

Conversation

@eerovaher

@eerovaher eerovaher commented Dec 17, 2021

Copy link
Copy Markdown
Member

Description

6816150 introduced a workaround to astropy.table.row.Row.as_void() that was necessitated by a bug in numpy < 1.8. Currently the minimum required numpy version is 1.18, so the previous code can be safely restored.

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see "When to rebase and squash commits".
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the Extra CI label.
  • Is a change log needed? If yes, did the change log check pass? If no, add the no-changelog-entry-needed label. If this is a manual backport, use the skip-changelog-checks label unless special changelog handling is necessary.
  • Is a milestone set? Milestone must be set but astropy-bot check might be missing; do not let the green checkmark fool you.
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate backport-X.Y.x label(s) before merge.

@github-actions github-actions Bot added the table label Dec 17, 2021
@pllim pllim added this to the v5.1 milestone Dec 17, 2021
@pllim

pllim commented Dec 17, 2021

Copy link
Copy Markdown
Member

Thanks! Looks like this was implemented way back in #2790. I have also kicked off cron jobs here, just in case.

@pllim
pllim requested a review from taldcroft December 17, 2021 14:46
@taldcroft

Copy link
Copy Markdown
Member

@eerovaher - thanks this looks great. This #2790 PR was an historic change in Table!

Can you track down where this is covered in tests? Since the original was so long ago and buried in a huge PR, it's worth just making sure we have coverage.

@taldcroft

Copy link
Copy Markdown
Member

The weekly cron failed with a segmentation fault. Not good. Seems unrelated but ???

@pllim

pllim commented Dec 17, 2021

Copy link
Copy Markdown
Member

segfault not related. @nstarman has a fix

@pllim

pllim commented Dec 17, 2021

Copy link
Copy Markdown
Member

(I'll be back later, maybe we can merge his fix, and rebase this to be sure...)

@pllim

pllim commented Dec 17, 2021

Copy link
Copy Markdown
Member

Ah, the fix is waiting for a change log - #12587

@eerovaher

Copy link
Copy Markdown
Member Author

Can you track down where this is covered in tests? Since the original was so long ago and buried in a huge PR, it's worth just making sure we have coverage.

6816150 also added tests as astropy.table.tests.test_row.test_data_and_as_void(). Those tests still exist, although the function containing them has been renamed to test_as_void():

def test_as_void(self, table_types):
"""Test the as_void() method"""
self._setup(table_types)
table = self.t
row = table[0]
# If masked then with no masks, issue numpy/numpy#483 should come
# into play. Make sure as_void() code is working.
row_void = row.as_void()
if table.masked:
assert isinstance(row_void, np.ma.mvoid)
else:
assert isinstance(row_void, np.void)
assert row_void['a'] == 1
assert row_void['b'] == 4
# Confirm row is a view of table but row_void is not.
table['a'][0] = -100
assert row['a'] == -100
assert row_void['a'] == 1
# Make sure it works for a table that has masked elements
if table.masked:
table['a'].mask = True
# row_void is not a view, need to re-make
assert row_void['a'] == 1
row_void = row.as_void() # but row is a view
assert row['a'] is np.ma.masked

@taldcroft

Copy link
Copy Markdown
Member

@eerovaher - great, looks good.

@pllim - do we need to wait on that units fix and rebase on that to merge?

@taldcroft

Copy link
Copy Markdown
Member

Looks like RTD is not finishing...

@pllim

pllim commented Dec 17, 2021

Copy link
Copy Markdown
Member

Let's wait a bit. There is no rush.

@pllim

pllim commented Dec 17, 2021

Copy link
Copy Markdown
Member

#12587 is merged. Please rebase. Thanks for your patience!

6816150 introduced a workaround to
`astropy.table.row.Row.as_void()` that was necessitated by a bug in
`numpy` < 1.8. Currently the minimum required `numpy` version is 1.18,
so the previous code can be safely restored.
@eerovaher
eerovaher force-pushed the rm-old-mvoid-workaround branch from 9069b15 to 0676d9c Compare December 17, 2021 21:44
@pllim pllim added the zzz 💤 merge-when-ci-passes Do not use: We have auto-merge option now. label Dec 17, 2021
@taldcroft
taldcroft merged commit 93145c5 into astropy:main Dec 19, 2021
@eerovaher
eerovaher deleted the rm-old-mvoid-workaround branch January 25, 2022 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Extra CI Run cron CI as part of PR no-changelog-entry-needed Refactoring table zzz 💤 merge-when-ci-passes Do not use: We have auto-merge option now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants