memoryview: re-add inheritance from Sequence, set index and count to None (#12800)

This reverts commit f625e92ae5.
This commit is contained in:
Jelle Zijlstra
2024-10-16 07:27:56 -07:00
committed by GitHub
parent 6feca18868
commit 2370b8b9d1
2 changed files with 9 additions and 1 deletions

View File

@@ -834,7 +834,7 @@ _IntegerFormats: TypeAlias = Literal[
]
@final
class memoryview(Generic[_I]):
class memoryview(Sequence[_I]):
@property
def format(self) -> str: ...
@property
@@ -897,6 +897,11 @@ class memoryview(Generic[_I]):
def __buffer__(self, flags: int, /) -> memoryview: ...
def __release_buffer__(self, buffer: memoryview, /) -> None: ...
# These are inherited from the Sequence ABC, but don't actually exist on memoryview.
# See https://github.com/python/cpython/issues/125420
index: ClassVar[None] # type: ignore[assignment]
count: ClassVar[None] # type: ignore[assignment]
@final
class bool(int):
def __new__(cls, o: object = ..., /) -> Self: ...