paleolimbot commented on a change in pull request #12011:
URL: https://github.com/apache/arrow/pull/12011#discussion_r773289253
##########
File path: python/pyarrow/types.pxi
##########
@@ -82,6 +84,26 @@ cdef bytes _datatype_to_pep3118(CDataType* type):
return char
+cdef void* _as_c_pointer(v, allow_null=False) except *:
+ """
+ Convert a Python object to a raw C pointer.
+
+ Used mainly for the C data interface.
+ Integers are accepted as well as capsule objects with a NULL name.
+ (the latter for compatibility with raw pointers exported by reticulate)
+ """
+ cdef void* c_ptr
+ if isinstance(v, int):
+ c_ptr = <void*> <uintptr_t > v
+ elif PyCapsule_CheckExact(v):
+ c_ptr = PyCapsule_GetPointer(v, NULL)
+ else:
Review comment:
I think the only good reason to support strings, int64, or raw arrays,
is because other language bridges might not be able to convert external
pointers and/or pycapsule objects. With reticulate we had a pretty good chance
of submitting a PR upstream (although it seems to work out of the box); other
language bridges may not be easy or fast to change.
--
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]