From 6f6dad117d6e1495d226952b1b80cea7ddad29af Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Thu, 29 Dec 2022 13:25:07 +0300 Subject: [PATCH] `compile` can only work with `ast.Module | ast.Expression | ast.Interactive` (#9424) --- stdlib/builtins.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 4296acf60..40865cc78 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1,6 +1,6 @@ +import _ast import sys import types -from _ast import AST from _collections_abc import dict_items, dict_keys, dict_values from _typeshed import ( AnyStr_co, @@ -1223,7 +1223,7 @@ if sys.version_info >= (3, 10): # TODO: `compile` has a more precise return type in reality; work on a way of expressing that? if sys.version_info >= (3, 8): def compile( - source: str | ReadableBuffer | AST, + source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive, filename: str | ReadableBuffer | _PathLike[Any], mode: str, flags: int = ..., @@ -1235,7 +1235,7 @@ if sys.version_info >= (3, 8): else: def compile( - source: str | ReadableBuffer | AST, + source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive, filename: str | ReadableBuffer | _PathLike[Any], mode: str, flags: int = ...,