From 295d2e0f9c528a88dfddd03c671432c96ff12f47 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 12:30:02 +0100 Subject: [PATCH 01/13] Add expat XMLParser methods These were added in point releases Closes: #15104 --- stdlib/@tests/stubtest_allowlists/py310.txt | 12 ++++++++++++ stdlib/@tests/stubtest_allowlists/py311.txt | 12 ++++++++++++ stdlib/@tests/stubtest_allowlists/py312.txt | 11 +++++++++++ stdlib/pyexpat/__init__.pyi | 5 +++++ 4 files changed, 40 insertions(+) diff --git a/stdlib/@tests/stubtest_allowlists/py310.txt b/stdlib/@tests/stubtest_allowlists/py310.txt index b7dc763c7248..37eb5d038cad 100644 --- a/stdlib/@tests/stubtest_allowlists/py310.txt +++ b/stdlib/@tests/stubtest_allowlists/py310.txt @@ -1,3 +1,15 @@ +# ========= +# Temporary +# ========= + + +# Will be added in 3.10.20 +pyexpat.XMLParserType.SetAllocTrackerActivationThreshold +pyexpat.XMLParserType.SetAllocTrackerMaximumAmplification +xml.parsers.expat.XMLParserType.SetAllocTrackerActivationThreshold +xml.parsers.expat.XMLParserType.SetAllocTrackerMaximumAmplification + + # ========================= # New errors in Python 3.10 # ========================= diff --git a/stdlib/@tests/stubtest_allowlists/py311.txt b/stdlib/@tests/stubtest_allowlists/py311.txt index fe0b34206cf9..1f36410deb4e 100644 --- a/stdlib/@tests/stubtest_allowlists/py311.txt +++ b/stdlib/@tests/stubtest_allowlists/py311.txt @@ -1,3 +1,15 @@ +# ========= +# Temporary +# ========= + + +# Will be added in 3.11.15 +pyexpat.XMLParserType.SetAllocTrackerActivationThreshold +pyexpat.XMLParserType.SetAllocTrackerMaximumAmplification +xml.parsers.expat.XMLParserType.SetAllocTrackerActivationThreshold +xml.parsers.expat.XMLParserType.SetAllocTrackerMaximumAmplification + + # ========================= # New errors in Python 3.11 # ========================= diff --git a/stdlib/@tests/stubtest_allowlists/py312.txt b/stdlib/@tests/stubtest_allowlists/py312.txt index ef1c5d12bf4a..d21fdfff468d 100644 --- a/stdlib/@tests/stubtest_allowlists/py312.txt +++ b/stdlib/@tests/stubtest_allowlists/py312.txt @@ -1,3 +1,14 @@ +# ========= +# Temporary +# ========= + +# Will be added in 3.12.13 +pyexpat.XMLParserType.SetAllocTrackerActivationThreshold +pyexpat.XMLParserType.SetAllocTrackerMaximumAmplification +xml.parsers.expat.XMLParserType.SetAllocTrackerActivationThreshold +xml.parsers.expat.XMLParserType.SetAllocTrackerMaximumAmplification + + # ========================= # New errors in Python 3.12 # ========================= diff --git a/stdlib/pyexpat/__init__.pyi b/stdlib/pyexpat/__init__.pyi index 21e676052098..17cab7498b6f 100644 --- a/stdlib/pyexpat/__init__.pyi +++ b/stdlib/pyexpat/__init__.pyi @@ -2,6 +2,7 @@ from _typeshed import ReadableBuffer, SupportsRead from collections.abc import Callable from pyexpat import errors as errors, model as model from typing import Any, Final, final +from psycopg2.extensions import Int from typing_extensions import CapsuleType, TypeAlias from xml.parsers.expat import ExpatError as ExpatError @@ -29,6 +30,10 @@ class XMLParserType: def UseForeignDTD(self, flag: bool = True, /) -> None: ... def GetReparseDeferralEnabled(self) -> bool: ... def SetReparseDeferralEnabled(self, enabled: bool, /) -> None: ... + # Added in Python 3.10.20, 3.11.15, 3.12.3, 3.13.10, 3.14.1 + def SetAllocTrackerActivationThreshold(self, threshold: int, /) -> None: ... + def SetAllocTrackerMaximumAmplification(self, max_factor: float, /) -> None: ... + @property def intern(self) -> dict[str, str]: ... buffer_size: int From 6c4a1a3ed0cadde64335aae2f675cf4860809ac0 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 12:32:43 +0100 Subject: [PATCH 02/13] Add version_info branch --- stdlib/pyexpat/__init__.pyi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stdlib/pyexpat/__init__.pyi b/stdlib/pyexpat/__init__.pyi index 17cab7498b6f..bc522d5f3c92 100644 --- a/stdlib/pyexpat/__init__.pyi +++ b/stdlib/pyexpat/__init__.pyi @@ -1,8 +1,8 @@ +import sys from _typeshed import ReadableBuffer, SupportsRead from collections.abc import Callable from pyexpat import errors as errors, model as model from typing import Any, Final, final -from psycopg2.extensions import Int from typing_extensions import CapsuleType, TypeAlias from xml.parsers.expat import ExpatError as ExpatError @@ -30,9 +30,10 @@ class XMLParserType: def UseForeignDTD(self, flag: bool = True, /) -> None: ... def GetReparseDeferralEnabled(self) -> bool: ... def SetReparseDeferralEnabled(self, enabled: bool, /) -> None: ... - # Added in Python 3.10.20, 3.11.15, 3.12.3, 3.13.10, 3.14.1 - def SetAllocTrackerActivationThreshold(self, threshold: int, /) -> None: ... - def SetAllocTrackerMaximumAmplification(self, max_factor: float, /) -> None: ... + if sys.version_info >= (3, 10): + # Added in Python 3.10.20, 3.11.15, 3.12.3, 3.13.10, 3.14.1 + def SetAllocTrackerActivationThreshold(self, threshold: int, /) -> None: ... + def SetAllocTrackerMaximumAmplification(self, max_factor: float, /) -> None: ... @property def intern(self) -> dict[str, str]: ... From 80a207d042e0516632db5fee984c4e23a6b75440 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 12:41:17 +0100 Subject: [PATCH 03/13] HTMLParser.__init__ allowlist updates --- stdlib/@tests/stubtest_allowlists/darwin-py310.txt | 8 ++++++++ stdlib/@tests/stubtest_allowlists/darwin-py311.txt | 8 ++++++++ stdlib/@tests/stubtest_allowlists/darwin-py312.txt | 8 ++++++++ stdlib/@tests/stubtest_allowlists/darwin-py39.txt | 8 ++++++++ stdlib/@tests/stubtest_allowlists/darwin.txt | 8 -------- stdlib/@tests/stubtest_allowlists/linux-py310.txt | 6 +++--- stdlib/@tests/stubtest_allowlists/linux-py311.txt | 6 +++--- stdlib/@tests/stubtest_allowlists/linux-py312.txt | 6 +++--- stdlib/@tests/stubtest_allowlists/linux-py313.txt | 6 ------ stdlib/@tests/stubtest_allowlists/linux-py314.txt | 6 ------ stdlib/@tests/stubtest_allowlists/win32-py310.txt | 9 ++++++--- stdlib/@tests/stubtest_allowlists/win32-py311.txt | 9 ++++++--- stdlib/@tests/stubtest_allowlists/win32-py312.txt | 8 ++++++++ stdlib/@tests/stubtest_allowlists/win32-py39.txt | 9 ++++++--- stdlib/@tests/stubtest_allowlists/win32.txt | 8 -------- 15 files changed, 67 insertions(+), 46 deletions(-) delete mode 100644 stdlib/@tests/stubtest_allowlists/linux-py313.txt delete mode 100644 stdlib/@tests/stubtest_allowlists/linux-py314.txt diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py310.txt b/stdlib/@tests/stubtest_allowlists/darwin-py310.txt index 331f922dab66..df6bf0af1b91 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py310.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py310.txt @@ -1,3 +1,11 @@ +# ========= +# Temporary +# ========= + +# Added in Python 3.10.20 (parameter `scripting`) +html.parser.HTMLParser.__init__ + + # ======= # <= 3.12 # ======= diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py311.txt b/stdlib/@tests/stubtest_allowlists/darwin-py311.txt index 2d8079d43541..b389202caf35 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py311.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py311.txt @@ -1,3 +1,11 @@ +# ========= +# Temporary +# ========= + +# Added in Python 3.11.15 (parameter `scripting`) +html.parser.HTMLParser.__init__ + + # ============ # 3.11 to 3.12 # ============ diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py312.txt b/stdlib/@tests/stubtest_allowlists/darwin-py312.txt index c81581eb72b2..77684961b29b 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py312.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py312.txt @@ -1,3 +1,11 @@ +# ========= +# Temporary +# ========= + +# Added in Python 3.12.13 (parameter `scripting`) +html.parser.HTMLParser.__init__ + + # ============ # 3.11 to 3.12 # ============ diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py39.txt b/stdlib/@tests/stubtest_allowlists/darwin-py39.txt index 59728a27f23c..6c94d5c2030a 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py39.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py39.txt @@ -1,3 +1,11 @@ +# ========= +# Temporary +# ========= + +# Added in Python 3.9.25 (parameter `scripting`) +html.parser.HTMLParser.__init__ + + # ======= # <= 3.12 # ======= diff --git a/stdlib/@tests/stubtest_allowlists/darwin.txt b/stdlib/@tests/stubtest_allowlists/darwin.txt index 4b8d1d041499..bee977f6d21d 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin.txt @@ -10,14 +10,6 @@ (fcntl.F_SETLEASE)? # GNU extension -# ======= -# <= 3.14 -# ======= - -# Added in Python 3.9.25, 3.10.20, 3.11.15, 3.12.13, 3.13.10, 3.14.1 (parameter `scripting`) -html.parser.HTMLParser.__init__ - - # ========================================== # Modules that do not exist on MacOS systems # ========================================== diff --git a/stdlib/@tests/stubtest_allowlists/linux-py310.txt b/stdlib/@tests/stubtest_allowlists/linux-py310.txt index 559c5d4ce8bf..7673e9c65d23 100644 --- a/stdlib/@tests/stubtest_allowlists/linux-py310.txt +++ b/stdlib/@tests/stubtest_allowlists/linux-py310.txt @@ -1,6 +1,6 @@ -# ======= -# <= 3.14 -# ======= +# ========= +# Temporary +# ========= # Added in Python 3.10.20 (parameter `scripting`) html.parser.HTMLParser.__init__ diff --git a/stdlib/@tests/stubtest_allowlists/linux-py311.txt b/stdlib/@tests/stubtest_allowlists/linux-py311.txt index ce9d5d89f298..671201251e99 100644 --- a/stdlib/@tests/stubtest_allowlists/linux-py311.txt +++ b/stdlib/@tests/stubtest_allowlists/linux-py311.txt @@ -1,6 +1,6 @@ -# ======= -# <= 3.14 -# ======= +# ========= +# Temporary +# ========= # Added in Python 3.11.15 (parameter `scripting`) html.parser.HTMLParser.__init__ diff --git a/stdlib/@tests/stubtest_allowlists/linux-py312.txt b/stdlib/@tests/stubtest_allowlists/linux-py312.txt index 602a661fbc95..9ce8bbf9e13b 100644 --- a/stdlib/@tests/stubtest_allowlists/linux-py312.txt +++ b/stdlib/@tests/stubtest_allowlists/linux-py312.txt @@ -1,6 +1,6 @@ -# ======= -# <= 3.14 -# ======= +# ========= +# Temporary +# ========= # Added in Python 3.12.13 (parameter `scripting`) html.parser.HTMLParser.__init__ diff --git a/stdlib/@tests/stubtest_allowlists/linux-py313.txt b/stdlib/@tests/stubtest_allowlists/linux-py313.txt deleted file mode 100644 index 672b0cf50e09..000000000000 --- a/stdlib/@tests/stubtest_allowlists/linux-py313.txt +++ /dev/null @@ -1,6 +0,0 @@ -# ======= -# <= 3.14 -# ======= - -# Added in Python 3.13.10 (parameter `scripting`) -html.parser.HTMLParser.__init__ diff --git a/stdlib/@tests/stubtest_allowlists/linux-py314.txt b/stdlib/@tests/stubtest_allowlists/linux-py314.txt deleted file mode 100644 index 2e5d4a88255d..000000000000 --- a/stdlib/@tests/stubtest_allowlists/linux-py314.txt +++ /dev/null @@ -1,6 +0,0 @@ -# ======= -# <= 3.14 -# ======= - -# Added in Python 3.14.1 (parameter `scripting`) -html.parser.HTMLParser.__init__ diff --git a/stdlib/@tests/stubtest_allowlists/win32-py310.txt b/stdlib/@tests/stubtest_allowlists/win32-py310.txt index a49447e799b3..1c26b320d918 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py310.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py310.txt @@ -1,6 +1,9 @@ -# ======= -# <= 3.12 -# ======= +# ========= +# Temporary +# ========= + +# Added in Python 3.10.20 (parameter `scripting`) +html.parser.HTMLParser.__init__ # Added in Python 3.10.18 (parameter `escapable`) html.parser.HTMLParser.set_cdata_mode diff --git a/stdlib/@tests/stubtest_allowlists/win32-py311.txt b/stdlib/@tests/stubtest_allowlists/win32-py311.txt index 62c544055dcc..bcc6d7c17ad4 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py311.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py311.txt @@ -1,6 +1,9 @@ -# ======= -# <= 3.12 -# ======= +# ========= +# Temporary +# ========= + +# Added in Python 3.11.15 (parameter `scripting`) +html.parser.HTMLParser.__init__ # Added in Python 3.11.13 (parameter `escapable`) html.parser.HTMLParser.set_cdata_mode diff --git a/stdlib/@tests/stubtest_allowlists/win32-py312.txt b/stdlib/@tests/stubtest_allowlists/win32-py312.txt index 1c808d36db4e..c977d31f24eb 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py312.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py312.txt @@ -1,3 +1,11 @@ +# ========= +# Temporary +# ========= + +# Added in Python 3.12.13 (parameter `scripting`) +html.parser.HTMLParser.__init__ + + # ======= # >= 3.12 # ======= diff --git a/stdlib/@tests/stubtest_allowlists/win32-py39.txt b/stdlib/@tests/stubtest_allowlists/win32-py39.txt index ace75c0b6c20..26af9746ff27 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py39.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py39.txt @@ -1,6 +1,9 @@ -# ======= -# <= 3.12 -# ======= +# ========= +# Temporary +# ========= + +# Added in Python 3.9.25 (parameter `scripting`) +html.parser.HTMLParser.__init__ # Added in Python 3.9.23 (parameter `escapable`) html.parser.HTMLParser.set_cdata_mode diff --git a/stdlib/@tests/stubtest_allowlists/win32.txt b/stdlib/@tests/stubtest_allowlists/win32.txt index 1ac5529e7ebe..66695e1d87d3 100644 --- a/stdlib/@tests/stubtest_allowlists/win32.txt +++ b/stdlib/@tests/stubtest_allowlists/win32.txt @@ -9,14 +9,6 @@ _winapi.OpenFileMapping _winapi.VirtualQuerySize -# ======= -# <= 3.14 -# ======= - -# Added in Python 3.9.25, 3.10.20, 3.11.15, 3.12.13, 3.13.10, 3.14.1 (parameter `scripting`) -html.parser.HTMLParser.__init__ - - # ============================================ # Modules that do not exist on Windows systems # ============================================ From a3c8f7ce1e5f7e840e4756a1a21a27760d03fe86 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 12:42:04 +0100 Subject: [PATCH 04/13] Remove errno.ENOTCAPABLE from one allowlist --- stdlib/@tests/stubtest_allowlists/darwin-py313.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py313.txt b/stdlib/@tests/stubtest_allowlists/darwin-py313.txt index 8e59e29c1ecb..bb7f4bba4c2f 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py313.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py313.txt @@ -3,10 +3,3 @@ # ======= (mmap.MAP_32BIT)? # Exists locally on MacOS but not on GitHub - -# ================ -# Unclear problems -# ================ - -# Added in 3.11.1, flagged by stubtest on Python < 3.14 for unknown reasons -errno.ENOTCAPABLE From c879ba220558ccb6b0d3760f3cea81398dbf7818 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 12:47:56 +0100 Subject: [PATCH 05/13] heapq: Extend __all__ (3.14+) --- stdlib/heapq.pyi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/stdlib/heapq.pyi b/stdlib/heapq.pyi index 220c41f303fb..62a1750f75e1 100644 --- a/stdlib/heapq.pyi +++ b/stdlib/heapq.pyi @@ -1,3 +1,4 @@ +import sys from _heapq import * from _typeshed import SupportsRichComparison from collections.abc import Callable, Generator, Iterable @@ -5,6 +6,15 @@ from typing import Any, Final, TypeVar __all__ = ["heappush", "heappop", "heapify", "heapreplace", "merge", "nlargest", "nsmallest", "heappushpop"] +if sys.version_info >= (3, 14): + __all__ += [ + "heapify_max", + "heappop_max", + "heappush_max", + "heappushpop_max", + "heapreplace_max", + ] + _S = TypeVar("_S") __about__: Final[str] From da12ef80e6513b349bd7e8949185c9f3f3002f36 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 12:49:04 +0100 Subject: [PATCH 06/13] Add a comment --- stdlib/heapq.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/heapq.pyi b/stdlib/heapq.pyi index 62a1750f75e1..9fc71019fe08 100644 --- a/stdlib/heapq.pyi +++ b/stdlib/heapq.pyi @@ -7,6 +7,7 @@ from typing import Any, Final, TypeVar __all__ = ["heappush", "heappop", "heapify", "heapreplace", "merge", "nlargest", "nsmallest", "heappushpop"] if sys.version_info >= (3, 14): + # Added to __all__ in 3.14.1 __all__ += [ "heapify_max", "heappop_max", From ca029b34f1c794c187765c0cdbf3636fdd9d3dd8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 11:52:12 +0000 Subject: [PATCH 07/13] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/heapq.pyi | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/stdlib/heapq.pyi b/stdlib/heapq.pyi index 9fc71019fe08..ff8ba7ff1f82 100644 --- a/stdlib/heapq.pyi +++ b/stdlib/heapq.pyi @@ -8,13 +8,7 @@ __all__ = ["heappush", "heappop", "heapify", "heapreplace", "merge", "nlargest", if sys.version_info >= (3, 14): # Added to __all__ in 3.14.1 - __all__ += [ - "heapify_max", - "heappop_max", - "heappush_max", - "heappushpop_max", - "heapreplace_max", - ] + __all__ += ["heapify_max", "heappop_max", "heappush_max", "heappushpop_max", "heapreplace_max"] _S = TypeVar("_S") From 717c20ee7b6f30d7cb3d40914dbb187c7e8dd645 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 13:04:34 +0100 Subject: [PATCH 08/13] Mark mmap arguments as positional-only --- stdlib/mmap.pyi | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/stdlib/mmap.pyi b/stdlib/mmap.pyi index 8a5baba62914..aaf6e5823af6 100644 --- a/stdlib/mmap.pyi +++ b/stdlib/mmap.pyi @@ -54,28 +54,28 @@ class mmap: ) -> Self: ... def close(self) -> None: ... - def flush(self, offset: int = 0, size: int = ...) -> None: ... - def move(self, dest: int, src: int, count: int) -> None: ... + def flush(self, offset: int = 0, size: int = ..., /) -> None: ... + def move(self, dest: int, src: int, count: int, /) -> None: ... def read_byte(self) -> int: ... def readline(self) -> bytes: ... - def resize(self, newsize: int) -> None: ... + def resize(self, newsize: int, /) -> None: ... if sys.platform != "win32": - def seek(self, pos: int, whence: Literal[0, 1, 2, 3, 4] = os.SEEK_SET) -> None: ... + def seek(self, pos: int, whence: Literal[0, 1, 2, 3, 4] = os.SEEK_SET, /) -> None: ... else: - def seek(self, pos: int, whence: Literal[0, 1, 2] = os.SEEK_SET) -> None: ... + def seek(self, pos: int, whence: Literal[0, 1, 2] = os.SEEK_SET, /) -> None: ... def size(self) -> int: ... def tell(self) -> int: ... - def write_byte(self, byte: int) -> None: ... + def write_byte(self, byte: int, /) -> None: ... def __len__(self) -> int: ... closed: bool if sys.platform != "win32": - def madvise(self, option: int, start: int = 0, length: int = ...) -> None: ... + def madvise(self, option: int, start: int = 0, length: int = ..., /) -> None: ... - def find(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ... - def rfind(self, sub: ReadableBuffer, start: int = ..., stop: int = ...) -> int: ... - def read(self, n: int | None = None) -> bytes: ... - def write(self, bytes: ReadableBuffer) -> int: ... + def find(self, view: ReadableBuffer, start: int = ..., stop: int = ..., /) -> int: ... + def rfind(self, view: ReadableBuffer, start: int = ..., stop: int = ..., /) -> int: ... + def read(self, n: int | None = None, /) -> bytes: ... + def write(self, bytes: ReadableBuffer, /) -> int: ... @overload def __getitem__(self, key: int, /) -> int: ... @overload @@ -92,7 +92,7 @@ class mmap: # so we claim that there is also an __iter__ to help type checkers. def __iter__(self) -> Iterator[int]: ... def __enter__(self) -> Self: ... - def __exit__(self, *args: Unused) -> None: ... + def __exit__(self, exc_type: Unused, exc_value: Unused, traceback: Unused, /) -> None: ... def __buffer__(self, flags: int, /) -> memoryview: ... def __release_buffer__(self, buffer: memoryview, /) -> None: ... if sys.version_info >= (3, 13): From e7b49b3bbde47fa070e5b0974e00bf3744d8612a Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 13:15:18 +0100 Subject: [PATCH 09/13] More mmap fixes --- stdlib/@tests/stubtest_allowlists/py314.txt | 7 +++++++ stdlib/mmap.pyi | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index d3fd3a15592a..45a45741dd1d 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -43,6 +43,13 @@ importlib.util.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined threading.Condition.locked multiprocessing.dummy.Condition.locked +# Starting with Python 3.14.1, these methods accept None for some of their +# parameters, but would raise a TypeError with Python 3.14.0. +mmap.mmap.find +mmap.mmap.flush +mmap.mmap.madvise +mmap.mmap.rfind + # ==================================== # Pre-existing errors from Python 3.13 # ==================================== diff --git a/stdlib/mmap.pyi b/stdlib/mmap.pyi index aaf6e5823af6..98183acba40f 100644 --- a/stdlib/mmap.pyi +++ b/stdlib/mmap.pyi @@ -72,8 +72,8 @@ class mmap: if sys.platform != "win32": def madvise(self, option: int, start: int = 0, length: int = ..., /) -> None: ... - def find(self, view: ReadableBuffer, start: int = ..., stop: int = ..., /) -> int: ... - def rfind(self, view: ReadableBuffer, start: int = ..., stop: int = ..., /) -> int: ... + def find(self, view: ReadableBuffer, start: int = ..., end: int = ..., /) -> int: ... + def rfind(self, view: ReadableBuffer, start: int = ..., end: int = ..., /) -> int: ... def read(self, n: int | None = None, /) -> bytes: ... def write(self, bytes: ReadableBuffer, /) -> int: ... @overload From c471c87835345aa556db92e88cea9ccf2a069208 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 13:23:16 +0100 Subject: [PATCH 10/13] Multiprocessing fixes --- stdlib/@tests/stubtest_allowlists/py314.txt | 1 + stdlib/multiprocessing/dummy/__init__.pyi | 28 +++++++++++++++------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index 45a45741dd1d..51580f0e298c 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -49,6 +49,7 @@ mmap.mmap.find mmap.mmap.flush mmap.mmap.madvise mmap.mmap.rfind +multiprocessing.process.BaseProcess.__init__ # ==================================== # Pre-existing errors from Python 3.13 diff --git a/stdlib/multiprocessing/dummy/__init__.pyi b/stdlib/multiprocessing/dummy/__init__.pyi index 3cbeeb057791..62fef2b080f2 100644 --- a/stdlib/multiprocessing/dummy/__init__.pyi +++ b/stdlib/multiprocessing/dummy/__init__.pyi @@ -1,4 +1,5 @@ import array +import sys import threading import weakref from collections.abc import Callable, Iterable, Mapping, Sequence @@ -44,14 +45,25 @@ class DummyProcess(threading.Thread): _start_called: int @property def exitcode(self) -> Literal[0] | None: ... - def __init__( - self, - group: Any = None, - target: Callable[..., object] | None = None, - name: str | None = None, - args: Iterable[Any] = (), - kwargs: Mapping[str, Any] = {}, - ) -> None: ... + if sys.version_info >= (3, 14): + # Default changed in Python 3.14.1 + def __init__( + self, + group: Any = None, + target: Callable[..., object] | None = None, + name: str | None = None, + args: Iterable[Any] = (), + kwargs: Mapping[str, Any] | None = None, + ) -> None: ... + else: + def __init__( + self, + group: Any = None, + target: Callable[..., object] | None = None, + name: str | None = None, + args: Iterable[Any] = (), + kwargs: Mapping[str, Any] | None = {}, + ) -> None: ... Process = DummyProcess From 89fa38c2b9ceef32f929dd83f25d755bc19202a9 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 13:25:22 +0100 Subject: [PATCH 11/13] Change os.__all__ --- stdlib/os/__init__.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index bb0a57153948..5d0a536bced9 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -174,7 +174,8 @@ __all__ = [ "write", ] if sys.version_info >= (3, 14): - __all__ += ["readinto"] + # reload_environ was added to __all__ in Python 3.14.1 + __all__ += ["readinto", "reload_environ"] if sys.platform == "darwin" and sys.version_info >= (3, 12): __all__ += ["PRIO_DARWIN_BG", "PRIO_DARWIN_NONUI", "PRIO_DARWIN_PROCESS", "PRIO_DARWIN_THREAD"] if sys.platform == "darwin" and sys.version_info >= (3, 10): From 1e741457220b8eb46655bd130a11aa555dbac0c7 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 13:26:05 +0100 Subject: [PATCH 12/13] Add rlcompleter --- stdlib/pdb.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/pdb.pyi b/stdlib/pdb.pyi index 2f114b20572d..f936e94cda90 100644 --- a/stdlib/pdb.pyi +++ b/stdlib/pdb.pyi @@ -201,8 +201,8 @@ class Pdb(Bdb, Cmd): def completenames(self, text: str, line: str, begidx: int, endidx: int) -> list[str]: ... # type: ignore[override] if sys.version_info >= (3, 12): def set_convenience_variable(self, frame: FrameType, name: str, value: Any) -> None: ... - if sys.version_info >= (3, 13) and sys.version_info < (3, 14): - # Added in 3.13.8. + if sys.version_info >= (3, 13): + # Added in 3.13.8 and 3.14.1 @property def rlcompleter(self) -> type[Completer]: ... From b002320a5305d62138f5f36077738a123d15e1f7 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 4 Dec 2025 13:31:32 +0100 Subject: [PATCH 13/13] madvise doesn't exist on win32 --- stdlib/@tests/stubtest_allowlists/darwin-py314.txt | 8 ++++++++ stdlib/@tests/stubtest_allowlists/linux-py314.txt | 7 +++++++ stdlib/@tests/stubtest_allowlists/py314.txt | 1 - 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 stdlib/@tests/stubtest_allowlists/linux-py314.txt diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py314.txt b/stdlib/@tests/stubtest_allowlists/darwin-py314.txt index bb7f4bba4c2f..ddd16a1acb74 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py314.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py314.txt @@ -1,3 +1,11 @@ +# ========= +# 3.14 only +# ========= + +# Starting with Python 3.14.1, these methods accept None for some of their +# parameters, but would raise a TypeError with Python 3.14.0. +mmap.mmap.madvise + # ======= # >= 3.13 # ======= diff --git a/stdlib/@tests/stubtest_allowlists/linux-py314.txt b/stdlib/@tests/stubtest_allowlists/linux-py314.txt new file mode 100644 index 000000000000..98f33e427a30 --- /dev/null +++ b/stdlib/@tests/stubtest_allowlists/linux-py314.txt @@ -0,0 +1,7 @@ +# ========= +# 3.14 only +# ========= + +# Starting with Python 3.14.1, these methods accept None for some of their +# parameters, but would raise a TypeError with Python 3.14.0. +mmap.mmap.madvise diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index 51580f0e298c..ddb0c396a0da 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -47,7 +47,6 @@ multiprocessing.dummy.Condition.locked # parameters, but would raise a TypeError with Python 3.14.0. mmap.mmap.find mmap.mmap.flush -mmap.mmap.madvise mmap.mmap.rfind multiprocessing.process.BaseProcess.__init__