[issue10181] get_shape0 in memoryobject.c not checked for error return

Antoine Pitrou report at bugs.python.org
Tue Nov 2 23:34:59 CET 2010


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

> As far as I know, PEP 3118 serves its purpose of allowing extension
> modules like numpy and PIL to share data without needing to copy it
> around all the time. It's just that memoryview wasn't really part of
> that purpose (since all the affected third party libraries have their
> own objects for looking at memory), and it shows :P

The deeper issue is that there are no ownership or lifetime rules for
dynamically allocated fields in Py_buffer (such as strides and shape),
which itself isn't a PyObject. For very simple objects (such as bytes or
bytearray) it isn't really a problem, but it is in more complicated
situations; and there's no possible solution without a clear spec..

(and I'm not even talking of the issue of making slices of memoryviews,
since the buffer API itself doesn't handle slicing, which means the
memoryview object has to modify its inner Py_buffer...)

----------

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


More information about the Python-bugs-list mailing list