This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients JakeMont, jnoller, martin.panter, r.david.murray, sbt, serhiy.storchaka, skrah, zach.ware
Date 2015-10-29.23:37:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446161878.07.0.265717647024.issue25498@psf.upfronthosting.co.za>
In-reply-to
Content
Before the Issue 22896 changes, PyObject_AsWriteBuffer() was used, which requests a buffer with the PyBUF_WRITABLE flag. Currently we use “w*” argument parsing format, which also uses PyBUF_WRITABLE. (Incidentally, I suspect the C-contiguity check is redundant for “w*”; non-contiguous buffers trigger the “read-write” error instead.)

Now Eryksun’s patch changes to PyMemoryView_FromObject(), which requests a buffer with the PyBUF_FULL_RO flag (the most liberal), and only then checks for writability and contiguity. Could this be a problem for some kind of object that returns different buffers depending on the request flags?

I agree that the existing buffer and memory view APIs don’t seem to be very practical and well understood. PyMemoryView_FromBuffer() is also used in the “io” module. It doesn’t even try to save a reference to the underlying buffers, meaning it is possible for Python code to write into freed memory by saving the memory view object passed to the readinto() method.
History
Date User Action Args
2015-10-29 23:37:58martin.pantersetrecipients: + martin.panter, jnoller, r.david.murray, skrah, sbt, zach.ware, serhiy.storchaka, JakeMont
2015-10-29 23:37:58martin.pantersetmessageid: <1446161878.07.0.265717647024.issue25498@psf.upfronthosting.co.za>
2015-10-29 23:37:58martin.panterlinkissue25498 messages
2015-10-29 23:37:57martin.pantercreate