Skip to content

Commit c661ac3

Browse files
authored
importlib.abc: align input data types in InspectLoader.source_to_code builtin.compile inputs (#9852)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
1 parent 28b90d9 commit c661ac3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/importlib/abc.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import _ast
12
import sys
23
import types
34
from _typeshed import (
@@ -7,6 +8,7 @@ from _typeshed import (
78
OpenBinaryModeWriting,
89
OpenTextMode,
910
ReadableBuffer,
11+
StrPath,
1012
)
1113
from abc import ABCMeta, abstractmethod
1214
from collections.abc import Iterator, Mapping, Sequence
@@ -52,7 +54,9 @@ class InspectLoader(Loader):
5254
def get_source(self, fullname: str) -> str | None: ...
5355
def exec_module(self, module: types.ModuleType) -> None: ...
5456
@staticmethod
55-
def source_to_code(data: ReadableBuffer | str, path: str = "<string>") -> types.CodeType: ...
57+
def source_to_code(
58+
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: ReadableBuffer | StrPath = "<string>"
59+
) -> types.CodeType: ...
5660

5761
class ExecutionLoader(InspectLoader):
5862
@abstractmethod

0 commit comments

Comments
 (0)