jorisvandenbossche commented on code in PR #40294:
URL: https://github.com/apache/arrow/pull/40294#discussion_r1512286410
##########
python/pyarrow/tensor.pxi:
##########
@@ -282,10 +292,8 @@ strides: {0.strides}""".format(self)
buffer.readonly = 0
else:
buffer.readonly = 1
- # NOTE: This assumes Py_ssize_t == int64_t, and that the shape
- # and strides arrays lifetime is tied to the tensor's
- buffer.shape = <Py_ssize_t *> &self.tp.shape()[0]
- buffer.strides = <Py_ssize_t *> &self.tp.strides()[0]
+ buffer.shape = <Py_ssize_t *> cp.PyBytes_AsString(self._ssize_t_shape)
+ buffer.strides = <Py_ssize_t *>
cp.PyBytes_AsString(self._ssize_t_strides)
Review Comment:
Ah, the name of the function is just confusing, I should have looked at the
docstring of it. I was wondering why we need to convert the bytes to a "string"
(in the python sense), but what it does here is to convert it to a C string aka
char pointer. So this was just to get the pointer to the bytes, that makes
sense.
--
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]