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

On further reflection, I realised point 4 in that suggestion isn't reliable in 
a formal sense. Consider:

with memoryview(a) as m:
    m[:]

The slice won't reference the buffer again, but isn't guaranteed by the 
language definition to have been garbage collected at the time m.release() is 
called by the with statement.

Altering release() to simply decrement the reference count of the managed 
buffer would defeat the whole point of having that method, so it may be 
necessary to allow early release with outstanding references and then include a 
"still alive" check in the code that allows access to the buffer details 
(similar to the way weak references work).

----------

_______________________________________
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