Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions stdlib/@tests/test_cases/builtins/check_memoryview.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@
# An invalid literal should raise an error.
mv = memoryview(b"abc")
mv.cast("abc") # type: ignore

mv.index(42) # type: ignore
mv.count(42) # type: ignore
7 changes: 6 additions & 1 deletion stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ _IntegerFormats: TypeAlias = Literal[
]

@final
class memoryview(Generic[_I]):
class memoryview(Sequence[_I]):
@property
def format(self) -> str: ...
@property
Expand Down Expand Up @@ -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: ...
Expand Down
Loading