This is an automated email from the ASF dual-hosted git repository.
thisisnic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 7aca68211b GH-49649: [R] R non-API calls reported on CRAN (#49653)
7aca68211b is described below
commit 7aca68211bf4e786328a9260bbea62ad8929f8d6
Author: Nic Crane <[email protected]>
AuthorDate: Mon Apr 6 17:43:15 2026 +0100
GH-49649: [R] R non-API calls reported on CRAN (#49653)
### 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.
* GitHub Issue: #49649
Authored-by: Nic Crane <[email protected]>
Signed-off-by: Nic Crane <[email protected]>
---
r/src/arrow_cpp11.h | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/r/src/arrow_cpp11.h b/r/src/arrow_cpp11.h
index d28ad0fede..4329623851 100644
--- a/r/src/arrow_cpp11.h
+++ b/r/src/arrow_cpp11.h
@@ -208,14 +208,26 @@ Pointer r6_to_pointer(SEXP self) {
cpp11::stop("Invalid R object for %s, must be an ArrowObject",
type_name.c_str());
}
-#if R_VERSION >= R_Version(4, 5, 0)
+// R_UnboundValue and Rf_findVarInFrame are non-API as of R 4.6
+#if R_VERSION >= R_Version(4, 6, 0)
+ SEXP xp = R_NilValue;
+ if (R_existsVarInFrame(self, arrow::r::symbols::xp)) {
+ xp = R_getVar(arrow::r::symbols::xp, self, FALSE);
+ }
+ if (xp == R_NilValue) {
+ cpp11::stop("Invalid: self$`.:xp:.` is NULL");
+ }
+#elif R_VERSION >= R_Version(4, 5, 0)
SEXP xp = R_getVarEx(arrow::r::symbols::xp, self, FALSE, R_UnboundValue);
+ if (xp == R_UnboundValue || 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
void* p = R_ExternalPtrAddr(xp);
if (p == nullptr) {
@@ -227,7 +239,13 @@ Pointer r6_to_pointer(SEXP self) {
template <typename T>
void r6_reset_pointer(SEXP r6) {
-#if R_VERSION >= R_Version(4, 5, 0)
+// R_UnboundValue and Rf_findVarInFrame are non-API as of R 4.6
+#if R_VERSION >= R_Version(4, 6, 0)
+ if (!R_existsVarInFrame(r6, arrow::r::symbols::xp)) {
+ return;
+ }
+ SEXP xp = R_getVar(arrow::r::symbols::xp, r6, FALSE);
+#elif R_VERSION >= R_Version(4, 5, 0)
SEXP xp = R_getVarEx(arrow::r::symbols::xp, r6, FALSE, R_UnboundValue);
#else
SEXP xp = Rf_findVarInFrame(r6, arrow::r::symbols::xp);