paleolimbot commented on code in PR #33858:
URL: https://github.com/apache/arrow/pull/33858#discussion_r1167209940


##########
r/R/arrow-package.R:
##########
@@ -147,6 +153,12 @@ supported_dplyr_methods <- list(
   # Register extension types that we use internally
   reregister_extension_type(vctrs_extension_type(vctrs::unspecified()))
 
+  # Registers a callback to run at session exit
+  .onLoad <- function(libname, pkgname) {
+    print(parent.env(environment()))
+    reg.finalizer(parent.env(environment()), finalize_s3, onexit=TRUE)
+  }
+

Review Comment:
   I know you asked about this earlier and found `.onUnload()`...just putting a 
note here in case this gets forgotten about.
   
   If `.onUnload()` isn't working you can create your own environment an 
register a finalizer on that:
   
   ```r
   s3_finalizer <- new.env(parent = emptyenv())
   
   .onLoad <- function(...) {
     # ...
     reg.finalizer(s3_finalizer, finalize_s3, onexit=TRUE)
   }
   ```
   
   You probably shouldn't register a finalizer on the package namespace because 
somebody else might have done that (maybe even R).



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