Skip to content

Add @final to slice/memoryview/range #6289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 14, 2021
Merged
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
10 changes: 7 additions & 3 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ from _typeshed import (
SupportsRDivMod,
SupportsWrite,
)
from ast import AST, mod
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
from types import CodeType, MappingProxyType, TracebackType
from typing import (
Expand Down Expand Up @@ -62,6 +61,8 @@ from typing import (
)
from typing_extensions import Literal, SupportsIndex, TypeGuard, final

from _ast import AST

if sys.version_info >= (3, 9):
from types import GenericAlias

Expand Down Expand Up @@ -644,6 +645,7 @@ class bytearray(MutableSequence[int], ByteString):
def __gt__(self, __x: bytes) -> bool: ...
def __ge__(self, __x: bytes) -> bool: ...

@final
class memoryview(Sized, Sequence[int]):
format: str
itemsize: int
Expand Down Expand Up @@ -717,6 +719,7 @@ class bool(int):
def __rxor__(self, __x: int) -> int: ...
def __getnewargs__(self) -> tuple[int]: ...

@final
class slice(object):
start: Any
step: Any
Expand Down Expand Up @@ -937,6 +940,7 @@ class enumerate(Iterator[Tuple[int, _T]], Generic[_T]):
if sys.version_info >= (3, 9):
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...

@final
class range(Sequence[int]):
start: int
stop: int
Expand Down Expand Up @@ -1010,7 +1014,7 @@ if sys.version_info >= (3, 10):

if sys.version_info >= (3, 8):
def compile(
source: str | bytes | mod | AST,
source: str | bytes | AST,
filename: str | bytes | _PathLike[Any],
mode: str,
flags: int = ...,
Expand All @@ -1022,7 +1026,7 @@ if sys.version_info >= (3, 8):

else:
def compile(
source: str | bytes | mod | AST,
source: str | bytes | AST,
filename: str | bytes | _PathLike[Any],
mode: str,
flags: int = ...,
Expand Down