AlenkaF commented on code in PR #45818:
URL: https://github.com/apache/arrow/pull/45818#discussion_r2044537069


##########
python/pyarrow/scalar.pxi:
##########
@@ -887,7 +887,29 @@ cdef class BinaryScalar(Scalar):
 
     def __getbuffer__(self, cp.Py_buffer* buffer, int flags):
         cdef Buffer buf = self.as_buffer()
-        PyObject_GetBuffer(<object>buf, buffer, flags)
+
+        if buf.buffer.get().is_mutable():
+            buffer.readonly = 0
+        else:
+            if flags & cp.PyBUF_WRITABLE:
+                raise BufferError("Writable buffer requested but Arrow "
+                                  "buffer was not mutable")
+            buffer.readonly = 1
+        buffer.buf = <char *>buf.buffer.get().data()
+        buffer.len = buf.size
+        if buffer.buf == NULL:
+            # ARROW-16048: Ensure we don't export a NULL address.

Review Comment:
   ```suggestion
   ```
   
   We can remove this comment.



-- 
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