pitrou commented on code in PR #47339:
URL: https://github.com/apache/arrow/pull/47339#discussion_r2284784830


##########
python/pyarrow/_parquet_encryption.pyx:
##########
@@ -28,6 +28,12 @@ from pyarrow.lib cimport _Weakrefable
 from pyarrow.lib import tobytes, frombytes
 
 
+cdef extern from "Python.h":
+    # To let us get a PyObject* and avoid Cython auto-ref-counting
+    PyObject* PyBytes_FromStringAndSizeNative" PyBytes_FromStringAndSize"(
+        char *v, Py_ssize_t len) except NULL

Review Comment:
   I'm a bit surprised that this declaration is required. Cython already 
provides [a 
declaration](https://github.com/cython/cython/blob/b862800bda6cc5f540d3b7961350cd2b6ad00dbd/Cython/Includes/cpython/bytes.pxd#L32-L36)
 for this function and it would be surprised if it didn't have the right 
ref-counting behavior.
   
   (also, by the way, if we require Cython 3.1 we will gain implicit 
`std::string_view` conversion to/from `bytes` objects)



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

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

Reply via email to