[issue15903] Make rawiobase_read() read directly to bytes object
Richard Oudkerk
report at bugs.python.org
Tue Sep 18 12:47:50 CEST 2012
Richard Oudkerk added the comment:
> Then the view owns a reference to the bytes object. But that does not
> solve the problem that writable memoryviews based on a readonly object
> might be hanging around.
How about doing
PyObject_GetBuffer(b, &buf, PyBUF_WRITABLE);
view = PyMemoryView_FromBuffer(&buf);
// readinto view
PyBuffer_Release(&buf);
Would attempts to access a "leaked" reference to view now result in ValueError("operation forbidden on released memoryview object")? If so then I think this would be safe.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15903>
_______________________________________
More information about the Python-bugs-list
mailing list