You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Function cpp11::writable::r_vector<SEXPREC*>::r_vector(std::initializer_list<cpp11::named_arg>)::{lambda()#1}::operator()() const
[UP] unprotected variable names while calling allocating function Rf_mkCharCE cpp11/include/cpp11/list.hpp:91
Function cpp11::writable::r_vector<cpp11::r_bool>::r_vector(std::initializer_list<cpp11::named_arg>)::{lambda()#1}::operator()() const
[UP] unprotected variable names while calling allocating function Rf_mkCharCE cpp11/include/cpp11/r_vector.hpp:890
I believe it is saying we have an unprotected SEXP called names at the point that we call Rf_mkCharCE(). This is surely a false alarm, because Rf_setAttrib() protects names by installed it as an attribute on data_, but I guess we can try to work around it.
template <>
inline r_vector<SEXP>::r_vector(std::initializer_list<named_arg> il)
: cpp11::r_vector<SEXP>(safe[Rf_allocVector](VECSXP, il.size())),
capacity_(il.size()) {
unwind_protect([&] {
SEXP names = Rf_allocVector(STRSXP, capacity_);
Rf_setAttrib(data_, R_NamesSymbol, names);
auto it = il.begin();
for (R_xlen_t i = 0; i < capacity_; ++i, ++it) {
SEXP elt = it->value();
set_elt(data_, i, elt);
SEXP name = Rf_mkCharCE(it->name(), CE_UTF8);
SET_STRING_ELT(names, i, name);
}
});
}
The text was updated successfully, but these errors were encountered:
@kalibera: I'm seeing this with RSQLite and other packages. Do you agree that the early Rf_setAttrib() calls in https://github.com/r-lib/cpp11/blob/main/inst/include/cpp11/list.hpp#L83 protects the names variable? The set_elt() call is a simple SET_VECTOR_ELT(), and nothing else affects data_ (the owner of the protection)? Can you change rchk to stop flagging this as an error, or is it easier to work around (the fix by Mauricio is easy enough)? What would it take for a fix to appear on CRAN? Thanks!
https://raw.githubusercontent.com/kalibera/cran-checks/master/rchk/results/adfExplorer.out
https://raw.githubusercontent.com/kalibera/cran-checks/master/rchk/results/cpp11bigwig.out
I believe it is saying we have an unprotected SEXP called
names
at the point that we callRf_mkCharCE()
. This is surely a false alarm, becauseRf_setAttrib()
protectsnames
by installed it as an attribute ondata_
, but I guess we can try to work around it.The text was updated successfully, but these errors were encountered: