thisisnic commented on code in PR #48634:
URL: https://github.com/apache/arrow/pull/48634#discussion_r2642330597


##########
r/src/altrep.cpp:
##########
@@ -574,11 +575,10 @@ struct AltrepFactor : public 
AltrepVectorBase<AltrepFactor> {
     // the representation integer vector
     SEXP dup = PROTECT(Rf_shallow_duplicate(Materialize(alt)));
 
-    // additional attributes from the altrep
-    SEXP atts = PROTECT(Rf_duplicate(ATTRIB(alt)));
-    SET_ATTRIB(dup, atts);
+    // copy attributes from the altrep object
+    DUPLICATE_ATTRIB(dup, alt);
 
-    UNPROTECT(2);
+    UNPROTECT(1);

Review Comment:
   > 🤖 Note: DUPLICATE_ATTRIB also copies the OBJECT bit and S4 status, which 
the old code didn't do.
   
   Was unsure if this matters?



-- 
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]

Reply via email to