paleolimbot commented on code in PR #4130:
URL: https://github.com/apache/arrow-adbc/pull/4130#discussion_r2975586019
##########
r/adbcdrivermanager/src/radbc.cc:
##########
@@ -53,7 +54,12 @@ static int adbc_update_parent_child_count(SEXP xptr, int
delta) {
return NA_INTEGER;
}
- SEXP child_count_sexp = Rf_findVarInFrame(parent_env,
Rf_install(".child_count"));
+ SEXP child_count_sym = Rf_install(".child_count");
+#if defined(R_VERSION) && R_VERSION >= R_Version(4, 5, 0)
+ SEXP child_count_sexp = R_getVarEx(child_count_sym, parent_env, FALSE,
R_UnboundValue);
+#else
+ SEXP child_count_sexp = Rf_findVarInFrame(parent_env, child_count_sym);
+#endif
Review Comment:
```suggestion
SEXP child_count_sym = PROTECT(Rf_install(".child_count"));
#if defined(R_VERSION) && R_VERSION >= R_Version(4, 5, 0)
SEXP child_count_sexp = PROTECT(R_getVarEx(child_count_sym, parent_env,
FALSE, R_UnboundValue));
if (child_count_sexp == R_UnboundValue) {
Rf_error("Internal error: .child_count not found");
}
#else
SEXP child_count_sexp = PROTECT(Rf_findVarInFrame(parent_env,
child_count_sym));
#endif
```
##########
r/adbcdrivermanager/src/radbc.cc:
##########
Review Comment:
```suggestion
UNPROTECT(2);
return old_value;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]