From 0e4c59a0767e7f81ec8399c3ed3a99660c2823cf Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sat, 24 Dec 2022 21:43:44 +0300 Subject: [PATCH] `ast.get_docstring` does not work with arbitrary `AST` nodes (#9407) --- stdlib/ast.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index b2cff5b00..1c2d8a597 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -261,7 +261,7 @@ else: def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ... def fix_missing_locations(node: _T) -> _T: ... -def get_docstring(node: AST, clean: bool = ...) -> str | None: ... +def get_docstring(node: AsyncFunctionDef | FunctionDef | ClassDef | Module, clean: bool = ...) -> str | None: ... def increment_lineno(node: _T, n: int = ...) -> _T: ... def iter_child_nodes(node: AST) -> Iterator[AST]: ... def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ...