Skip to content

Commit b2b7ceb

Browse files
authored
sys.meta_path: don't require find_module() or supporting bytes paths (#6344)
1 parent 029cf55 commit b2b7ceb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

stdlib/sys.pyi

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from builtins import object as _object
3-
from importlib.abc import Loader, PathEntryFinder
3+
from importlib.abc import PathEntryFinder
44
from importlib.machinery import ModuleSpec
55
from io import TextIOWrapper
66
from types import FrameType, ModuleType, TracebackType
@@ -26,12 +26,10 @@ _T = TypeVar("_T")
2626
# The following type alias are stub-only and do not exist during runtime
2727
_ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
2828
_OptExcInfo = Union[_ExcInfo, Tuple[None, None, None]]
29-
_PathSequence = Sequence[Union[bytes, str]]
3029

31-
# Unlike importlib.abc.MetaPathFinder, invalidate_caches() might not exist (see python docs)
30+
# Intentionally omits one deprecated and one optional method of `importlib.abc.MetaPathFinder`
3231
class _MetaPathFinder(Protocol):
33-
def find_module(self, fullname: str, path: _PathSequence | None) -> Loader | None: ...
34-
def find_spec(self, fullname: str, path: _PathSequence | None, target: ModuleType | None = ...) -> ModuleSpec | None: ...
32+
def find_spec(self, fullname: str, path: Sequence[str] | None, target: ModuleType | None = ...) -> ModuleSpec | None: ...
3533

3634
# ----- sys variables -----
3735
if sys.platform != "win32":

0 commit comments

Comments
 (0)