From 725f7177b1f618c37546b11e85e67e1d6ae78867 Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Sat, 10 May 2025 19:32:20 +0000 Subject: [PATCH] Update `ast.main` function for Python 3.14 (#13982) --- stdlib/@tests/stubtest_allowlists/py314.txt | 1 - stdlib/ast.pyi | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index bfbf9cd9f..8caa76c90 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -251,7 +251,6 @@ ast.arg.__annotations_cache__ ast.arguments.__annotations_cache__ ast.comprehension.__annotations_cache__ ast.keyword.__annotations_cache__ -ast.main ast.match_case.__annotations_cache__ ast.withitem.__annotations_cache__ asyncio.__all__ diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index bced1cb45..64dc5f2af 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -7,7 +7,7 @@ from _ast import ( PyCF_TYPE_COMMENTS as PyCF_TYPE_COMMENTS, ) from _typeshed import ReadableBuffer, Unused -from collections.abc import Iterable, Iterator +from collections.abc import Iterable, Iterator, Sequence from typing import Any, ClassVar, Generic, Literal, TypedDict, TypeVar as _TypeVar, overload from typing_extensions import Self, Unpack, deprecated @@ -2016,4 +2016,9 @@ class NodeTransformer(NodeVisitor): # is also allowed in some cases -- this needs to be mapped. def unparse(ast_obj: AST) -> str: ... -def main() -> None: ... + +if sys.version_info >= (3, 14): + def main(args: Sequence[str] | None = None) -> None: ... + +else: + def main() -> None: ...