From c661ac3ad6dc32d789e7458654dda49d095b2ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oleg=20H=C3=B6fling?= Date: Wed, 8 Mar 2023 14:43:05 +0100 Subject: [PATCH] `importlib.abc`: align input data types in `InspectLoader.source_to_code` `builtin.compile` inputs (#9852) Signed-off-by: oleg.hoefling --- stdlib/importlib/abc.pyi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stdlib/importlib/abc.pyi b/stdlib/importlib/abc.pyi index 4fe2fed27..4bf46104b 100644 --- a/stdlib/importlib/abc.pyi +++ b/stdlib/importlib/abc.pyi @@ -1,3 +1,4 @@ +import _ast import sys import types from _typeshed import ( @@ -7,6 +8,7 @@ from _typeshed import ( OpenBinaryModeWriting, OpenTextMode, ReadableBuffer, + StrPath, ) from abc import ABCMeta, abstractmethod from collections.abc import Iterator, Mapping, Sequence @@ -52,7 +54,9 @@ class InspectLoader(Loader): def get_source(self, fullname: str) -> str | None: ... def exec_module(self, module: types.ModuleType) -> None: ... @staticmethod - def source_to_code(data: ReadableBuffer | str, path: str = "") -> types.CodeType: ... + def source_to_code( + data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: ReadableBuffer | StrPath = "" + ) -> types.CodeType: ... class ExecutionLoader(InspectLoader): @abstractmethod