[issue19321] memoryview should be a context manager

STINNER Victor report at bugs.python.org
Mon Oct 21 02:13:00 CEST 2013


STINNER Victor added the comment:

> Already proposed in issue9757.

Well, it was not only proposed, but it was also implemented (by Antoine).

Python 3.4.0a3+ (default:84a8b797c5c5+, Oct 20 2013, 16:02:32) 
[GCC 4.8.1 20130603 (Red Hat 4.8.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x=memoryview(b'abc')
>>> with x: pass
... 
>>> bytes(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: operation forbidden on released memoryview object

----------

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


More information about the Python-bugs-list mailing list