diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 38be452e8d49..ed2217e79446 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -731,8 +731,13 @@ class bytes(Sequence[int]): def translate(self, table: ReadableBuffer | None, /, delete: ReadableBuffer = b"") -> bytes: ... def upper(self) -> bytes: ... def zfill(self, width: SupportsIndex, /) -> bytes: ... - @classmethod - def fromhex(cls, string: str, /) -> Self: ... + if sys.version_info >= (3, 14): + @classmethod + def fromhex(cls, string: str | ReadableBuffer, /) -> Self: ... + else: + @classmethod + def fromhex(cls, string: str, /) -> Self: ... + @staticmethod def maketrans(frm: ReadableBuffer, to: ReadableBuffer, /) -> bytes: ... def __len__(self) -> int: ... @@ -836,8 +841,13 @@ class bytearray(MutableSequence[int]): def translate(self, table: ReadableBuffer | None, /, delete: bytes = b"") -> bytearray: ... def upper(self) -> bytearray: ... def zfill(self, width: SupportsIndex, /) -> bytearray: ... - @classmethod - def fromhex(cls, string: str, /) -> Self: ... + if sys.version_info >= (3, 14): + @classmethod + def fromhex(cls, string: str | ReadableBuffer, /) -> Self: ... + else: + @classmethod + def fromhex(cls, string: str, /) -> Self: ... + @staticmethod def maketrans(frm: ReadableBuffer, to: ReadableBuffer, /) -> bytes: ... def __len__(self) -> int: ...