Author ncoghlan
Recipients kermode, loewis, mark.dickinson, ncoghlan, pitrou, pv, rupole, teoliphant
Date 2011-02-14.12:02:23
SpamBayes Score 6.36974e-06
Marked as misclassified No
Message-id <1297684943.84.0.84922549062.issue10181@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2011-02-14 12:02:23ncoghlansetrecipients: + ncoghlan, loewis, teoliphant, mark.dickinson, rupole, kermode, pitrou, pv
2011-02-14 12:02:23ncoghlansetmessageid: <1297684943.84.0.84922549062.issue10181@psf.upfronthosting.co.za>
2011-02-14 12:02:23ncoghlanlinkissue10181 messages
2011-02-14 12:02:23ncoghlancreate