mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +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:
committed by
Sebastian Rittau
parent
8b9e4c378a
commit
6afa610191
@@ -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