[issue4580] slicing of memoryviews when itemsize != 1 is wrong

Antoine Pitrou report at bugs.python.org
Wed Dec 10 17:20:36 CET 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

Thanks for your comments. I'll provide an updated patch later today and
let you take a look.

>  * Memoryview object should report it's length as self->view.shape[0]
> unless self->view.shape is NULL (indicating in this case a 0-d array or
> scalar).  In this case, it should raise an error.

Are 0-d arrays (scalars) really useful? Could we make things simpler by
simply removing support for them?

>  * The buffer protocol is clear about who owns the memory for shape and
> strides (and suboffsets).  The exporter does and it is responsible for
> not changing them until releasebuffer is called.

But how do we do when slicing a memoryview? The new (sliced) memoryview
object clearly must alter the shape after the buffer has been filled in
by the exporter.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4580>
_______________________________________


More information about the Python-bugs-list mailing list