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
Currently, a nullptr but not an R_NilValue can be assigned to an external_ptr<> object. This is inconsistent and surprising, in particular because the roundtrip works correctly the other way. Should we support this?
I can't see a good reason why it shouldn't accept R_NilValue (given that that is what the default constructor assigns). A simple change to external_pointer::valid_type() should fix this, i.e.
static SEXP valid_type(SEXP data) {
if (data == nullptr) {
throwtype_error(EXTPTRSXP, NILSXP);
}
if (TYPEOF(data) != EXTPTRSXP && data != R_NilValue) {
throwtype_error(EXTPTRSXP, TYPEOF(data));
}
return data;
}
Currently, a
nullptr
but not anR_NilValue
can be assigned to anexternal_ptr<>
object. This is inconsistent and surprising, in particular because the roundtrip works correctly the other way. Should we support this?CC @hannes @Tmonster.
Created on 2023-04-02 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: