[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)
Stefan Krah
report at bugs.python.org
Mon Jul 4 12:42:29 CEST 2011
Stefan Krah <stefan-usenet at bytereef.org> added the comment:
Nick Coghlan <report at bugs.python.org> wrote:
> The reason redirecting all requests to the underlying object doesn't work
> is because repeated calls to getbuffer on mutable objects are allowed to
> return *different* answers. Assume we have a mutable array type that allows
> changes while memory is exported by keeping the old buffer around until all
> references are released. Then we want the following behaviour:
>
> The builtin bytearray avoids this issue by simply disallowing mutation while
> a buffer is exported, but memoryview needs to cope with arbitrary third party
> objects which may behave like the hypothetical mutable_byte_array().
I find this behavior quite sane. Would it not be an option to make this
a requirement in the PEP? As far as I can see, Numpy also disallows
mutations on exported buffers.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10181>
_______________________________________
More information about the Python-bugs-list
mailing list