jorisvandenbossche commented on code in PR #42223:
URL: https://github.com/apache/arrow/pull/42223#discussion_r1722989904


##########
python/pyarrow/device.pxi:
##########
@@ -64,6 +64,9 @@ cdef class Device(_Weakrefable):
         self.init(device)
         return self
 
+    cdef inline shared_ptr[CDevice] unwrap(self) nogil:

Review Comment:
   In practice it's what we do for almost all our `unwrap` functions (and the 
few that don't use it probably should for consistency)
   
   But the reason is 1) that this function does not need to GIL (there is no 
Python interaction), so it _can_ be marked with `nogil`, and 2) actually 
marking it as such ensures that we can call this method from within a `with 
nogil: ...` block (and given that calling `unwrap()` is typically needed when 
calling some C++ function, and we typically use `with nogil: ...` blocks when 
we are calling a C++ function, in practice there are quite some cases where we 
indeed use `unwrap()` inside such a block)



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