From b459329cecd10433cbc93bb939dcd4a33edc40ea Mon Sep 17 00:00:00 2001 From: Pavel Karateev Date: Wed, 24 Nov 2021 00:28:53 +0300 Subject: [PATCH] Add __complex__ to complex and __bytes__ to bytes for Python 3.11 (#6369) --- stdlib/builtins.pyi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index dfafe6f73..2dbeaa1d8 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -347,6 +347,8 @@ class complex: def __abs__(self) -> float: ... def __hash__(self) -> int: ... def __bool__(self) -> bool: ... + if sys.version_info >= (3, 11): + def __complex__(self) -> complex: ... class _FormatMapMapping(Protocol): def __getitem__(self, __key: str) -> Any: ... @@ -536,6 +538,8 @@ class bytes(ByteString): def __gt__(self, __x: bytes) -> bool: ... def __ge__(self, __x: bytes) -> bool: ... def __getnewargs__(self) -> tuple[bytes]: ... + if sys.version_info >= (3, 11): + def __bytes__(self) -> bytes: ... class bytearray(MutableSequence[int], ByteString): @overload