Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,7 @@ class zip(Iterator[_T_co], Generic[_T_co]):
def __iter__(self) -> Iterator[_T_co]: ...
def __next__(self) -> _T_co: ...

# Signature of `builtins.__import__` should be kept identical to `importlib.__import__`
# Return type of `__import__` should be kept the same as return type of `importlib.import_module`
def __import__(
name: str,
Expand Down
18 changes: 10 additions & 8 deletions stdlib/importlib/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import types
from importlib.abc import Loader
from typing import Any, Mapping, Sequence
from types import ModuleType
from typing import Mapping, Sequence

# `__import__` and `import_module` return type should be kept the same as `builtins.__import__`
# Signature of `builtins.__import__` should be kept identical to `importlib.__import__`
def __import__(
name: str,
globals: Mapping[str, Any] | None = ...,
locals: Mapping[str, Any] | None = ...,
globals: Mapping[str, object] | None = ...,
locals: Mapping[str, object] | None = ...,
fromlist: Sequence[str] = ...,
level: int = ...,
) -> types.ModuleType: ...
def import_module(name: str, package: str | None = ...) -> types.ModuleType: ...
) -> ModuleType: ...

# `importlib.import_module` return type should be kept the same as `builtins.__import__`
def import_module(name: str, package: str | None = ...) -> ModuleType: ...
def find_loader(name: str, path: str | None = ...) -> Loader | None: ...
def invalidate_caches() -> None: ...
def reload(module: types.ModuleType) -> types.ModuleType: ...
def reload(module: ModuleType) -> ModuleType: ...