[Python-Dev] Allocation of shape and strides fields in Py_buffer
Travis Oliphant
oliphant.travis at ieee.org
Wed Dec 10 16:44:06 CET 2008
Antoine Pitrou wrote:
> Hello,
>
> The Py_buffer struct has two pointers named `shape` and `strides`. Each points
> to an array of Py_ssize_t values whose length is equal to the number of
> dimensions of the buffer object. Unfortunately, the buffer protocol spec doesn't
> explain how allocation of these arrays should be handled.
>
I'm coming in late to this discussion, so I apologize for being out of
order. But, as Nick later clarifies, the PEP *does* specify how
allocation of these arrays is handled.
Specifically, it is the responsibility of the exporter to do it and keep
them correct as long as the buffer is shared.
I have not been able to keep up with the python-dev mailing lists since
I have been working full time outside of academia. I apologize for the
difficulty this may have caused. But, I have been available via email
and am happy to respond to specific questions regarding the buffer
protocol and its implementation.
I will make some time during December to help clean up confusing issues.
There are still pieces to implement as well (the enhancements to the
struct module, for example), but I will not have time for this in the
next 6 months because I would like to spend any time I can find on
porting NumPy to use the new buffer protocol as part of getting NumPy
ready for 3.0.
-Travis
More information about the Python-Dev
mailing list