[Python-Dev] Allocation of shape and strides fields in Py_buffer (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Wed Dec 10 13:58:20 CET 2008


Nick Coghlan <ncoghlan gmail.com> writes:

I don't see anything wrong with the PEP 3118 protocol.

Apart from the fact that:

... I agree there's nothing wrong with it!

That Pybuffer describes the whole data store, but a memoryview slice may only be exposing part of it - so while the info in the Pybuffer is accurate for the underlying object, it is not accurate for the memoryview itself.

And the problem here is that Py_buffer is/was (*) not flexible enough to allow easy modification in order to take a sub-buffer without some annoying problems.

(*) my patch solves the one-dimensional case. People interested in the multi-dimensional case will have to do their homework themselves!

Regards

Antoine.



More information about the Python-Dev mailing list