Author ncoghlan
Recipients kermode, loewis, mark.dickinson, ncoghlan, pitrou, pv, rupole, teoliphant
Date 2011-02-14.11:41:42
SpamBayes Score 4.7396e-09
Marked as misclassified No
Message-id <1297683702.78.0.921023517817.issue10181@psf.upfronthosting.co.za>
In-reply-to
Content
OK, to summarise that revisit into a coherent proposal:

1. Add "PyManagedBuffer" as an even lower level wrapper around Py_buffer. The only thing this would support is doing GetBuffer on construction and ReleaseBuffer when destroyed (or when explicitly asked to do so), as well as access to the information in the Py_buffer struct.

2. Adjust PyMemoryView to use that object to access the source object that implements the PEP 3118 API.

3. When copying or slicing memoryview objects, the new PyMemoryView instance acquires a reference to the existing PyManagedBuffer instance instead of creating a new one.

4. If memoryview.release() attempts to explicitly release the buffer, but there are additional references to the PyManagedBuffer object, the request will fail with a BufferError.

5. dup_buffer is deleted (with extreme prejudice)

6. 3rd party code is encouraged in the C API documentation to never ever copy Py_buffer structs around and to use PyManagedBuffer instead.
History
Date User Action Args
2011-02-14 11:41:42ncoghlansetrecipients: + ncoghlan, loewis, teoliphant, mark.dickinson, rupole, kermode, pitrou, pv
2011-02-14 11:41:42ncoghlansetmessageid: <1297683702.78.0.921023517817.issue10181@psf.upfronthosting.co.za>
2011-02-14 11:41:42ncoghlanlinkissue10181 messages
2011-02-14 11:41:42ncoghlancreate