[issue9757] Add context manager protocol to memoryviews

Nick Coghlan report at bugs.python.org
Wed Sep 8 00:03:45 CEST 2010


Nick Coghlan <ncoghlan at gmail.com> added the comment:

>> Is this not covered by PEP 3118 at all?
>
> The PEP says “this memory view object holds on to the memory of base
> [i.e. the object the buffer was acquired from] until it is deleted”.
> Apparently issues pertaining to delayed garbage collection weren't
> raised at the time.

As with a few(!) other things in relation to this PEP, the primary
consumers were most interested in the C API side of things, so we
collectively missed relevant details on the Python side.

+1 on adding release() (obviously), and +1 on direct support for
context management (it seems very analogous to file.close to me, so
direct support makes more sense than leaving it out).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9757>
_______________________________________


More information about the Python-bugs-list mailing list