pitrou commented on code in PR #5070:
URL: https://github.com/apache/arrow-rs/pull/5070#discussion_r1391751340


##########
arrow-data/src/ffi.rs:
##########
@@ -66,8 +66,12 @@ impl Drop for FFI_ArrowArray {
 unsafe impl Send for FFI_ArrowArray {}
 unsafe impl Sync for FFI_ArrowArray {}
 
-// callback used to drop [FFI_ArrowArray] when it is exported
-unsafe extern "C" fn release_array(array: *mut FFI_ArrowArray) {
+/// callback used to drop [FFI_ArrowArray] when it is exported
+///
+/// # Safety
+///
+/// Must be passed a valid [FFI_ArrowArray].
+pub unsafe extern "C" fn release_array(array: *mut FFI_ArrowArray) {

Review Comment:
   > I'm not familiar with the pycapsule internals, but one thing I wonder is 
whether it runs _any_ destructor if you use `PyCapsule::new` instead of 
`PyCapsule::new_with_destructor`.
   
   Yes, it seems it does.
   
https://github.com/PyO3/pyo3/blob/c8fdb806300ff82747f58bcb9ca08abd3da480b4/src/types/capsule.rs#L273-L282
   and
   
https://github.com/PyO3/pyo3/blob/c8fdb806300ff82747f58bcb9ca08abd3da480b4/src/types/capsule.rs#L78-L84



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to