From 8cbb7167c6b167ecf9f0595b90ff396859122ca7 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 26 May 2025 12:14:49 +0300 Subject: [PATCH] Update `types.py` for 3.14 (#14146) --- stdlib/@tests/stubtest_allowlists/py314.txt | 2 -- stdlib/types.pyi | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index 223ee2285..dd93165c5 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -51,8 +51,6 @@ turtle.fill turtle.no_animation turtle.poly turtle.save -types.CodeType.co_branches -types.FrameType.f_generator # ========================= # New errors in Python 3.14 diff --git a/stdlib/types.pyi b/stdlib/types.pyi index 3a1bffd00..8bb07d166 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -171,6 +171,8 @@ class CodeType: @property def co_qualname(self) -> str: ... def co_positions(self) -> Iterable[tuple[int | None, int | None, int | None, int | None]]: ... + if sys.version_info >= (3, 14): + def co_branches(self) -> Iterator[tuple[int, int, int]]: ... if sys.version_info >= (3, 11): def __new__( @@ -580,6 +582,9 @@ class FrameType: f_trace_lines: bool f_trace_opcodes: bool def clear(self) -> None: ... + if sys.version_info >= (3, 14): + @property + def f_generator(self) -> GeneratorType[Any, Any, Any] | CoroutineType[Any, Any, Any] | None: ... @final class GetSetDescriptorType: