From 58e083fef91a757a707a5727f2bfffa124251b7b Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Sat, 1 May 2021 21:38:10 -0700 Subject: [PATCH] Marked the `bool` class as `@final` because it cannot be subclassed. (#5286) Co-authored-by: Eric Traut --- stdlib/@python2/__builtin__.pyi | 3 ++- stdlib/@python2/builtins.pyi | 3 ++- stdlib/builtins.pyi | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/stdlib/@python2/__builtin__.pyi b/stdlib/@python2/__builtin__.pyi index ed42c1e8f..4eb5424d8 100644 --- a/stdlib/@python2/__builtin__.pyi +++ b/stdlib/@python2/__builtin__.pyi @@ -44,7 +44,7 @@ from typing import ( ValuesView, overload, ) -from typing_extensions import Literal +from typing_extensions import Literal, final class _SupportsIndex(Protocol): def __index__(self) -> int: ... @@ -568,6 +568,7 @@ class memoryview(Sized, Container[str]): def tobytes(self) -> bytes: ... def tolist(self) -> List[int]: ... +@final class bool(int): def __new__(cls: Type[_T], __o: object = ...) -> _T: ... @overload diff --git a/stdlib/@python2/builtins.pyi b/stdlib/@python2/builtins.pyi index ed42c1e8f..4eb5424d8 100644 --- a/stdlib/@python2/builtins.pyi +++ b/stdlib/@python2/builtins.pyi @@ -44,7 +44,7 @@ from typing import ( ValuesView, overload, ) -from typing_extensions import Literal +from typing_extensions import Literal, final class _SupportsIndex(Protocol): def __index__(self) -> int: ... @@ -568,6 +568,7 @@ class memoryview(Sized, Container[str]): def tobytes(self) -> bytes: ... def tolist(self) -> List[int]: ... +@final class bool(int): def __new__(cls: Type[_T], __o: object = ...) -> _T: ... @overload diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 6e75c5ef7..8553a2c09 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -60,7 +60,7 @@ from typing import ( ValuesView, overload, ) -from typing_extensions import Literal, SupportsIndex +from typing_extensions import Literal, SupportsIndex, final if sys.version_info >= (3, 9): from types import GenericAlias @@ -666,6 +666,7 @@ class memoryview(Sized, Container[int]): else: def hex(self) -> str: ... +@final class bool(int): def __new__(cls: Type[_T], __o: object = ...) -> _T: ... @overload