From d24394fa2fc92eb98ab5914c370760480604d5e1 Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Fri, 8 Aug 2025 09:03:27 +0000 Subject: [PATCH] [zlib] Add `ZLIBNG_VERSION` (#14513) Co-authored-by: Brian Schubert --- stdlib/@tests/stubtest_allowlists/win32-py314.txt | 8 -------- stdlib/zlib.pyi | 12 ++++++++---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/win32-py314.txt b/stdlib/@tests/stubtest_allowlists/win32-py314.txt index 83e72a2d7..070fce3e9 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py314.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py314.txt @@ -1,11 +1,3 @@ -# ==================================================================== -# TODO: New errors in Python 3.14 that need to be fixed or moved below -# ==================================================================== - -compression.zlib.ZLIBNG_VERSION -zlib.ZLIBNG_VERSION - - # ======= # >= 3.12 # ======= diff --git a/stdlib/zlib.pyi b/stdlib/zlib.pyi index 7cafb44b3..4e410fdd1 100644 --- a/stdlib/zlib.pyi +++ b/stdlib/zlib.pyi @@ -4,11 +4,11 @@ from typing import Any, Final, final, type_check_only from typing_extensions import Self DEFLATED: Final = 8 -DEF_MEM_LEVEL: int # can change +DEF_MEM_LEVEL: Final[int] DEF_BUF_SIZE: Final = 16384 -MAX_WBITS: int -ZLIB_VERSION: str # can change -ZLIB_RUNTIME_VERSION: str # can change +MAX_WBITS: Final[int] +ZLIB_VERSION: Final[str] +ZLIB_RUNTIME_VERSION: Final[str] Z_NO_COMPRESSION: Final = 0 Z_PARTIAL_FLUSH: Final = 1 Z_BEST_COMPRESSION: Final = 9 @@ -26,6 +26,10 @@ Z_RLE: Final = 3 Z_SYNC_FLUSH: Final = 2 Z_TREES: Final = 6 +if sys.version_info >= (3, 14) and sys.platform == "win32": + # Available when zlib was built with zlib-ng, usually only on Windows + ZLIBNG_VERSION: Final[str] + class error(Exception): ... # This class is not exposed at runtime. It calls itself zlib.Compress.