Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-43748: [R] Handle package_version in safe_r_metadata #43895

Merged

Conversation

nealrichardson
Copy link
Member

@nealrichardson nealrichardson commented Aug 31, 2024

Rationale for this change

See #43748. There is what appears to be a bug in R's [[.numeric_version implementation that leads to infinite recursion.

Edit: after some digging in R source, this appears to be as designed. And other list subclasses that have methods to make them behave like atomic types, like POSIXlt, also have this.

What changes are included in this PR?

When recursing into list objects, unclass() them first to get the raw list behavior. Also apply the checking to the attributes() before reapplying them.

Are these changes tested?

yes

Are there any user-facing changes?

Fewer bugs!

r/R/metadata.R Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Sep 1, 2024
Copy link
Member

@jonkeane jonkeane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! I'm not totally surprised by this slightly odd package version thing.

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Sep 11, 2024
@nealrichardson nealrichardson merged commit 5b968b3 into apache:main Sep 12, 2024
12 checks passed
@nealrichardson nealrichardson deleted the package-version-safe-metadata branch September 12, 2024 01:14
Copy link

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 5b968b3.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 1 possible false positive for unstable benchmarks that are known to sometimes produce them.

khwilson pushed a commit to khwilson/arrow that referenced this pull request Sep 14, 2024
…#43895)

### Rationale for this change

See apache#43748. There is what appears to be a bug in R's
`[[.numeric_version` implementation that leads to infinite recursion.

Edit: after some digging in R source, this appears to be as designed.
And other list subclasses that have methods to make them behave like
atomic types, like `POSIXlt`, also have this.

### What changes are included in this PR?

When recursing into list objects, `unclass()` them first to get the raw
list behavior. Also apply the checking to the `attributes()` before
reapplying them.

### Are these changes tested?

yes

### Are there any user-facing changes?

Fewer bugs!

* GitHub Issue: apache#43748
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants