mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-10-16 11:01:27 +08:00
memoryview is a context manager (#2442)
Since Python 3.2, __enter__ returns self and __exit__ calls self.release()
This commit is contained in:
1 parent
8b9e4c378a
commit
6afa610191
1 file changed
+2
@@ -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: ...
|
||||
|
||||
Reference in new issue
Block a user