pitrou commented on a change in pull request #12011:
URL: https://github.com/apache/arrow/pull/12011#discussion_r773242898
##########
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:
But in which situation would you get a string in the first place?
--
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]