From f9cedff5af015cd2814b3e9ed05ebe10e778585d Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Fri, 10 Dec 2021 21:48:46 -0800 Subject: [PATCH] ast: allow non-literal strings (#6566) Co-authored-by: hauntsaninja <> --- stdlib/ast.pyi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index 94d76f6cf..8494a3a99 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -215,6 +215,15 @@ if sys.version_info >= (3, 8): type_comments: bool = ..., feature_version: None | int | _typing.Tuple[int, int] = ..., ) -> Interactive: ... + @overload + def parse( + source: str | bytes, + filename: str | bytes = ..., + mode: str = ..., + *, + type_comments: bool = ..., + feature_version: None | int | _typing.Tuple[int, int] = ..., + ) -> AST: ... else: @overload @@ -227,6 +236,8 @@ else: def parse(source: str | bytes, *, mode: Literal["eval"]) -> Expression: ... @overload def parse(source: str | bytes, *, mode: Literal["single"]) -> Interactive: ... + @overload + def parse(source: str | bytes, filename: str | bytes = ..., mode: str = ...) -> AST: ... if sys.version_info >= (3, 9): def unparse(ast_obj: AST) -> str: ...