From 209383988df720cb374107e32a418ebd73a1a3c2 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Tue, 13 May 2025 18:12:57 +0300 Subject: [PATCH] Add new `ast` node from 3.14 (#14034) --- stdlib/@tests/stubtest_allowlists/py314.txt | 2 -- stdlib/ast.pyi | 32 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index fd106a659..516ef9a31 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -15,8 +15,6 @@ _socket.IP_RECVTTL _socket.if_indextoname _thread.RLock.locked _thread.set_name -ast.Interpolation -ast.TemplateStr asyncio.__all__ asyncio._AbstractEventLoopPolicy asyncio._DefaultEventLoopPolicy diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index 64dc5f2af..f26ec4d1a 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -1,3 +1,4 @@ +import builtins import os import sys import typing_extensions @@ -1063,6 +1064,37 @@ class JoinedStr(expr): if sys.version_info >= (3, 14): def __replace__(self, *, values: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> Self: ... +if sys.version_info >= (3, 14): + class TemplateStr(expr): + __match_args__ = ("values",) + values: list[expr] + def __init__(self, values: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> None: ... + def __replace__(self, *, values: list[expr] = ..., **kwargs: Unpack[_Attributes]) -> Self: ... + + class Interpolation(expr): + __match_args__ = ("value", "str", "conversion", "format_spec") + value: expr + str: builtins.str + conversion: int + format_spec: builtins.str | None = None + def __init__( + self, + value: expr = ..., + str: builtins.str = ..., + conversion: int = ..., + format_spec: builtins.str | None = ..., + **kwargs: Unpack[_Attributes], + ) -> None: ... + def __replace__( + self, + *, + value: expr = ..., + str: builtins.str = ..., + conversion: int = ..., + format_spec: builtins.str | None = ..., + **kwargs: Unpack[_Attributes], + ) -> Self: ... + class Constant(expr): if sys.version_info >= (3, 10): __match_args__ = ("value", "kind")