Message128540
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). |
|
Date |
User |
Action |
Args |
2011-02-14 12:02:23 | ncoghlan | set | recipients:
+ ncoghlan, loewis, teoliphant, mark.dickinson, rupole, kermode, pitrou, pv |
2011-02-14 12:02:23 | ncoghlan | set | messageid: <1297684943.84.0.84922549062.issue10181@psf.upfronthosting.co.za> |
2011-02-14 12:02:23 | ncoghlan | link | issue10181 messages |
2011-02-14 12:02:23 | ncoghlan | create | |
|