Nick Coghlan <ncogh...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10181>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to