You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "pitrou (via GitHub)" <gi...@apache.org> on 2023/05/24 17:35:29 UTC

[GitHub] [arrow-adbc] pitrou commented on a diff in pull request #702: feat(python/adbc_driver_manager): experiment with using PyCapsules

pitrou commented on code in PR #702:
URL: https://github.com/apache/arrow-adbc/pull/702#discussion_r1204553343


##########
python/adbc_driver_manager/adbc_driver_manager/_lib.pyx:
##########
@@ -460,6 +461,18 @@ cdef class _AdbcHandle:
                     f"with open {self._child_type}")
 
 
+cdef void pycapsule_stream_deleter(object stream_capsule):
+    cdef:
+        CArrowArrayStream* stream
+    # Do not invoke the deleter on a used/moved capsule
+    stream = <CArrowArrayStream*>cpython.PyCapsule_GetPointer(
+        stream_capsule, 'arrowarraystream'
+    )

Review Comment:
   You don't need to check for error, Cython will do it for you thanks to its `PyCapsule_GetPointer` declaration here:
   https://github.com/cython/cython/blob/d73164b56544def09b65d250d72b227a38944bb1/Cython/Includes/cpython/pycapsule.pxd#L50
   



-- 
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-unsubscribe@arrow.apache.org

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