[Python-Dev] Allocation of shape and strides fields in Py_buffer
Antoine Pitrou
solipsis at pitrou.net
Tue Dec 9 00:25:20 CET 2008
Nick Coghlan <ncoghlan <at> gmail.com> writes:
>
> No, you misunderstand what I meant. Py_buffer doesn't need to be changed
> at all. The *issuing type* would define a new structure with the
> additional fields, such as:
With to the current buffer API, this is not possible. It's the caller who
allocates the Py_buffer struct (usually on the stack), not the callee. Therefore
the callee (e.g. the getbufferproc of the issuing type) cannot choose to
allocate a different structure.
(of course complex schemes can be devised where the callee maintains its own
separate storage for shape and strides, but I don't think we want to go there)
> Alexander's suggestion of going and looking at what the numpy folks have
> done in this area is probably a good idea too.
Well, I'm open to others doing this, but I won't do it myself. My interest is in
fixing the most glaring bugs of the buffer API and memoryview object. The numpy
folks are welcome to voice their opinions and give advice on python-dev.
Regards
Antoine.
More information about the Python-Dev
mailing list