[issue4580] slicing of memoryviews when itemsize != 1 is wrong
Antoine Pitrou
report at bugs.python.org
Wed Dec 10 00:21:17 CET 2008
Antoine Pitrou <pitrou at free.fr> added the comment:
Hi Nick,
> 1. memoryview needs to be fixed so that internally self->view.len is
> always the length in bytes, even after taking a slice of the view
This is in my patch, unless I'm missing something?
> 2. memoryview needs to be fixed so that len() reflects the number of
> items in the view (i.e. self->view.shape[0]), not the total number of bytes
Why should that be? There's nothing suggesting that in the PEP. On the
other hand I agree it looks a bit higher-level.
> 3. array.array needs to be fixed so that it populates the shape array (a
> pointer to the arrays own internal length field should be adequate)
array.array is broken but that's a separate issue IMO (see e.g. #4509).
This issue is for fixing memoryview.
> 4. PyObject_GetBuffer needs to raise an exception if it sees ndim > 0
> with a NULL shape array in the resulting Py_buffer.
I'm for it, except that we must make sure that nobody really relies on
the current behaviour. I'm not sure there's only array.array.
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4580>
_______________________________________
More information about the Python-bugs-list
mailing list