diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index de7194ed75c2..27ee52e54d3d 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -185,10 +185,10 @@ class int: def bit_length(self) -> int: ... if sys.version_info >= (3, 10): def bit_count(self) -> int: ... - def to_bytes(self, length: int, byteorder: str, *, signed: bool = ...) -> bytes: ... + def to_bytes(self, length: int, byteorder: Literal["little", "big"], *, signed: bool = ...) -> bytes: ... @classmethod def from_bytes( - cls, bytes: Union[Iterable[int], SupportsBytes], byteorder: str, *, signed: bool = ... + cls, bytes: Union[Iterable[int], SupportsBytes], byteorder: Literal["little", "big"], *, signed: bool = ... ) -> int: ... # TODO buffer object argument def __add__(self, x: int) -> int: ... def __sub__(self, x: int) -> int: ... diff --git a/stdlib/sys.pyi b/stdlib/sys.pyi index 49623565ddcf..5f0f4ab99534 100644 --- a/stdlib/sys.pyi +++ b/stdlib/sys.pyi @@ -22,6 +22,7 @@ from typing import ( Union, overload, ) +from typing_extensions import Literal _T = TypeVar("_T") @@ -43,7 +44,7 @@ if sys.platform != "win32": argv: List[str] base_exec_prefix: str base_prefix: str -byteorder: str +byteorder: Literal["little", "big"] builtin_module_names: Sequence[str] # actually a tuple of strings copyright: str if sys.platform == "win32":