mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
compile can only work with ast.Module | ast.Expression | ast.Interactive (#9424)
This commit is contained in:
@@ -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 = ...,
|
||||
|
||||
Reference in New Issue
Block a user