From edd8b11a603caa0682edea14d0da2fc41ce51de3 Mon Sep 17 00:00:00 2001 From: Huanyi Xie <74809554+xiehuanyi@users.noreply.github.com> Date: Mon, 12 Oct 2026 13:18:24 +0300 Subject: [PATCH] Accept integer-like checksum seed values --- stdlib/binascii.pyi | 6 +++--- stdlib/zlib.pyi | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stdlib/binascii.pyi b/stdlib/binascii.pyi index 6840c6883811..b363f94c1bb5 100644 --- a/stdlib/binascii.pyi +++ b/stdlib/binascii.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import ReadableBuffer -from typing import TypeAlias +from typing import SupportsIndex, TypeAlias from typing_extensions import deprecated # Many functions in binascii accept buffer objects @@ -85,8 +85,8 @@ if sys.version_info < (3, 11): @deprecated("Deprecated since Python 3.9; removed in Python 3.11.") def b2a_hqx(data: ReadableBuffer, /) -> bytes: ... -def crc_hqx(data: ReadableBuffer, crc: int, /) -> int: ... -def crc32(data: ReadableBuffer, crc: int = 0, /) -> int: ... +def crc_hqx(data: ReadableBuffer, crc: SupportsIndex, /) -> int: ... +def crc32(data: ReadableBuffer, crc: SupportsIndex = 0, /) -> int: ... def b2a_hex(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = 1) -> bytes: ... def hexlify(data: ReadableBuffer, sep: str | bytes = ..., bytes_per_sep: int = 1) -> bytes: ... diff --git a/stdlib/zlib.pyi b/stdlib/zlib.pyi index 557fa761feeb..b507770601d9 100644 --- a/stdlib/zlib.pyi +++ b/stdlib/zlib.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import ReadableBuffer -from typing import Any, Final, final, type_check_only +from typing import Any, Final, SupportsIndex, final, type_check_only from typing_extensions import Self DEFLATED: Final = 8 @@ -58,7 +58,7 @@ class _Decompress: def flush(self, length: int = 16384, /) -> bytes: ... def copy(self) -> _Decompress: ... -def adler32(data: ReadableBuffer, value: int = 1, /) -> int: ... +def adler32(data: ReadableBuffer, value: SupportsIndex = 1, /) -> int: ... if sys.version_info >= (3, 15): def adler32_combine(adler1: int, adler2: int, len2: int, /) -> int: ... @@ -72,7 +72,7 @@ else: def compressobj( level: int = -1, method: int = 8, wbits: int = 15, memLevel: int = 8, strategy: int = 0, zdict: ReadableBuffer | None = None ) -> _Compress: ... -def crc32(data: ReadableBuffer, value: int = 0, /) -> int: ... +def crc32(data: ReadableBuffer, value: SupportsIndex = 0, /) -> int: ... if sys.version_info >= (3, 15): def crc32_combine(crc1: int, crc2: int, len2: int, /) -> int: ...