Skip to content

GH-49649: [R] R non-API calls reported on CRAN#49653

Open
thisisnic wants to merge 1 commit intoapache:mainfrom
thisisnic:GH-49649-more-non-api
Open

GH-49649: [R] R non-API calls reported on CRAN#49653
thisisnic wants to merge 1 commit intoapache:mainfrom
thisisnic:GH-49649-more-non-api

Conversation

@thisisnic
Copy link
Copy Markdown
Member

@thisisnic thisisnic commented Apr 2, 2026

Rationale for this change

CRAN reports non-API calls

What changes are included in this PR?

Swap 'em out

Are these changes tested?

I'll test with CI

Are there any user-facing changes?

Nah

AI usage

Used Claude, asked it lots of questions about what it was doing and why, answers sounded reasonable.

@thisisnic thisisnic requested a review from jonkeane as a code owner April 2, 2026 21:57
@github-actions github-actions bot added Component: R awaiting committer review Awaiting committer review labels Apr 2, 2026
@thisisnic
Copy link
Copy Markdown
Member Author

Once this is reviewed, we should rebase it on #49655 before this so we can check it properly.

Comment on lines -391 to +403
// R_existsVarInFrame doesn't exist before R 4.2, so we need to fall back to
// Rf_findVarInFrame3 if it is not defined.
#if R_VERSION >= R_Version(4, 2, 0)
#if R_VERSION >= R_Version(4, 6, 0)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand this change? Why do we need to bump this version higher?

cpp11::stop("No arrow R6 class named '%s'", r6_class_name);
}
#else
// Rf_findVarInFrame3 and R_UnboundValue are non-API as of R 4.6
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But this else was only <4.2.0 anyway no?

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Apr 3, 2026
// returns the namespace environment for package `name`
SEXP precious_namespace(std::string name) {
SEXP s_name = PROTECT(cpp11::writable::strings({name}));
SEXP ns = R_FindNamespace(s_name);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see any NOTEs about this one? Do we need to remove it?

Comment on lines -211 to +224
#if R_VERSION >= R_Version(4, 5, 0)
SEXP xp = R_getVarEx(arrow::r::symbols::xp, self, FALSE, R_UnboundValue);
#if R_VERSION >= R_Version(4, 6, 0)
if (!R_existsVarInFrame(self, arrow::r::symbols::xp)) {
cpp11::stop("Invalid: self$`.:xp:.` is NULL");
}
SEXP xp = R_getVar(arrow::r::symbols::xp, self, FALSE);
if (xp == R_NilValue) {
cpp11::stop("Invalid: self$`.:xp:.` is NULL");
}
#else
SEXP xp = Rf_findVarInFrame(self, arrow::r::symbols::xp);
#endif
if (xp == R_UnboundValue || xp == R_NilValue) {
cpp11::stop("Invalid: self$`.:xp:.` is NULL");
}
#endif
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We might need three branches here: <4.5, >=4.5<4.6, >=4.6 so that we avoid Rf_findVarInFrame on oldrel right?

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