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

Yeah, the reason my originally proposed semantics were wrong is because copying 
(or slicing) a memoryview object and then explicitly releasing that object 
would always fail through no fault of that code. That would be broken and the 
only way to fix it is to allow the release() call but not actually call the 
ReleaseBuffer API until all the buffer references are gone.

Exports are different - whenever you copy or slice a memoryview, you get a new 
memoryview object with the export count set to zero, so it is reasonable to 
require that anyone that wants to explicitly release the memoryview's buffer 
reference make sure that there aren't any exports hanging around. Keep in mind 
that memoryview copies and slices don't increase the export count, as those 
will refer directly back to the original managed buffer.

+1 on tracking buffer exports explicitly rather than relying solely on playing 
games with refcounts though - while technically redundant in the ManagedBuffer 
case, I agree it will make the code far more self-explanatory.

----------

_______________________________________
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