jorisvandenbossche commented on code in PR #39977:
URL: https://github.com/apache/arrow/pull/39977#discussion_r1482912440
##########
python/pyarrow/types.pxi:
##########
@@ -114,7 +123,14 @@ cdef void* _as_c_pointer(v, allow_null=False) except *:
"Arrow library", UserWarning, stacklevel=2)
c_ptr = <void*> <uintptr_t > v
elif PyCapsule_CheckExact(v):
- c_ptr = PyCapsule_GetPointer(v, NULL)
+ capsule_name = PyCapsule_GetName(v)
+ if capsule_name == NULL or strcmp(capsule_name, "r_extptr") == 0:
Review Comment:
We have a `frombytes` helper that you could also use here
`frombytes(capsule_name) == "r_extptr`.
Cython generally converts between python and c objects transparently (in
which case `capsule_name == b"r_extptr"` might work out of the box), although
in the case of a C string (`char*`) it might be that an explicit assignment is
needed from reading the docs.
--
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]