From ba8b2585c6da458c980429a9fc062a143a5ee004 Mon Sep 17 00:00:00 2001 From: Shantanu Date: Mon, 20 Jan 2020 01:50:59 -0600 Subject: [PATCH] ast: some fixes for py38 (#3625) * ast: make parse args keyword-only * ast: get_source_segment is py38 on --- stdlib/3/ast.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/3/ast.pyi b/stdlib/3/ast.pyi index 7d58a80fd..8cb78fbf5 100644 --- a/stdlib/3/ast.pyi +++ b/stdlib/3/ast.pyi @@ -31,6 +31,7 @@ if sys.version_info >= (3, 8): source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: Literal["exec"] = ..., + *, type_comments: bool = ..., feature_version: Union[None, int, _typing.Tuple[int, int]] = ..., ) -> Module: ... @@ -39,6 +40,7 @@ if sys.version_info >= (3, 8): source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ..., + *, type_comments: bool = ..., feature_version: Union[None, int, _typing.Tuple[int, int]] = ..., ) -> AST: ... @@ -60,5 +62,6 @@ def increment_lineno(node: _T, n: int = ...) -> _T: ... def iter_child_nodes(node: AST) -> Iterator[AST]: ... def iter_fields(node: AST) -> Iterator[_typing.Tuple[str, Any]]: ... def literal_eval(node_or_string: Union[str, AST]) -> Any: ... -def get_source_segment(source: str, node: AST, *, padded: bool = ...) -> Optional[str]: ... +if sys.version_info >= (3, 8): + def get_source_segment(source: str, node: AST, *, padded: bool = ...) -> Optional[str]: ... def walk(node: AST) -> Iterator[AST]: ...