memoryview is a context manager (#2442)

Since Python 3.2, __enter__ returns self and __exit__ calls self.release()
This commit is contained in:
Zac Hatfield-Dodds
2018-09-11 22:13:38 +10:00
committed by Sebastian Rittau
parent 8b9e4c378a
commit 6afa610191

View File

@@ -495,6 +495,8 @@ class memoryview(Sized, Container[int]):
ndim = ... # type: int
def __init__(self, obj: Union[bytes, bytearray, memoryview]) -> None: ...
def __enter__(self) -> memoryview: ...
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ...
@overload
def __getitem__(self, i: int) -> int: ...