diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index df082f301..838d7209b 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -3,8 +3,8 @@ from typing import ( TypeVar, Iterator, Iterable, overload, Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic, - Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs, - SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString + Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsBytes, + SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString ) from abc import abstractmethod, ABCMeta @@ -255,6 +255,8 @@ class bytes(ByteString): def __init__(self, length: int) -> None: ... @overload def __init__(self) -> None: ... + @overload + def __init__(self, o: SupportsBytes) -> None: ... def capitalize(self) -> bytes: ... def center(self, width: int, fillchar: bytes = None) -> bytes: ... def count(self, x: bytes) -> int: ... diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index 89fac9284..c6d50b79b 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -56,6 +56,14 @@ class SupportsFloat(metaclass=ABCMeta): @abstractmethod def __float__(self) -> float: ... +class SupportsComplex(metaclass=ABCMeta): + @abstractmethod + def __complex__(self) -> complex: pass + +class SupportsBytes(metaclass=ABCMeta): + @abstractmethod + def __bytes__(self) -> bytes: pass + class SupportsAbs(Generic[_T]): @abstractmethod def __abs__(self) -> _T: ...