[issue22896] Don't use PyObject_As*Buffer() functions
Serhiy Storchaka
report at bugs.python.org
Sun Feb 1 23:13:01 CET 2015
Serhiy Storchaka added the comment:
from_buffer() uses a memory buffer of other object. It keeps a reference to the object to prevent deallocation of memory when there will be no more external references. But this doesn't prevent from reallocating of memory of living object (e.g. for resizing of bytearray). So we need to grab the buffer (with PyObject_GetBuffer) in from_buffer() and free it (with PyBuffer_Release) when it is no longer needed. menoryview can do this but needs a hack, because a memoryview created by PyMemoryView_FromBuffer() doesn't release the buffer. May be there is more official way?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22896>
_______________________________________
More information about the Python-bugs-list
mailing list