Skip to content

Commit a44d822

Browse files
authored
[_frozen_importlib_external] Python 3.15 updates (#16036)
1 parent e2226e9 commit a44d822

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

stdlib/@tests/stubtest_allowlists/py315.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# TODO: Allowlist entries that should be fixed
33
# ============================================
44

5-
_frozen_importlib_external.PathFinder.discover
65
dataclasses.MISSING
76
dataclasses._MISSING_TYPE
87
dataclasses.field

stdlib/_frozen_importlib_external.pyi

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ class PathFinder(importlib.abc.MetaPathFinder):
7474
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `find_spec()` instead.")
7575
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...
7676

77+
if sys.version_info >= (3, 15):
78+
@classmethod
79+
def discover(cls, parent: ModuleSpec | None = None) -> Iterator[ModuleSpec]: ...
80+
7781
SOURCE_SUFFIXES: Final[list[str]]
7882
DEBUG_BYTECODE_SUFFIXES: Final = [".pyc"]
7983
OPTIMIZED_BYTECODE_SUFFIXES: Final = [".pyc"]
@@ -88,6 +92,9 @@ class FileFinder(importlib.abc.PathEntryFinder):
8892
cls, *loader_details: tuple[type[importlib.abc.Loader], list[str]]
8993
) -> Callable[[str], importlib.abc.PathEntryFinder]: ...
9094

95+
if sys.version_info >= (3, 15):
96+
def discover(self, parent: ModuleSpec | None = None) -> Iterator[ModuleSpec]: ...
97+
9198
class _LoaderBasics:
9299
def is_package(self, fullname: str) -> bool: ...
93100
def create_module(self, spec: ModuleSpec) -> types.ModuleType | None: ...
@@ -153,7 +160,7 @@ class ExtensionFileLoader(FileLoader, _LoaderBasics, importlib.abc.ExecutionLoad
153160
if sys.version_info >= (3, 15):
154161
class NamespacePath:
155162
def __init__(
156-
self, name: str, path: MutableSequence[str], path_finder: Callable[[str, tuple[str, ...]], ModuleSpec]
163+
self, name: str, path: MutableSequence[str], path_finder: Callable[[str, tuple[str, ...]], ModuleSpec | None]
157164
) -> None: ...
158165
def __iter__(self) -> Iterator[str]: ...
159166
def __getitem__(self, index: int) -> str: ...
@@ -162,10 +169,12 @@ if sys.version_info >= (3, 15):
162169
def __contains__(self, item: str) -> bool: ...
163170
def append(self, item: str) -> None: ...
164171

172+
_NamespacePath = NamespacePath
173+
165174
if sys.version_info >= (3, 11):
166175
class NamespaceLoader(importlib.abc.InspectLoader):
167176
def __init__(
168-
self, name: str, path: MutableSequence[str], path_finder: Callable[[str, tuple[str, ...]], ModuleSpec]
177+
self, name: str, path: MutableSequence[str], path_finder: Callable[[str, tuple[str, ...]], ModuleSpec | None]
169178
) -> None: ...
170179
def is_package(self, fullname: str) -> Literal[True]: ...
171180
def get_source(self, fullname: str) -> Literal[""]: ...
@@ -188,7 +197,7 @@ if sys.version_info >= (3, 11):
188197
else:
189198
class _NamespaceLoader:
190199
def __init__(
191-
self, name: str, path: MutableSequence[str], path_finder: Callable[[str, tuple[str, ...]], ModuleSpec]
200+
self, name: str, path: MutableSequence[str], path_finder: Callable[[str, tuple[str, ...]], ModuleSpec | None]
192201
) -> None: ...
193202
def is_package(self, fullname: str) -> Literal[True]: ...
194203
def get_source(self, fullname: str) -> Literal[""]: ...

0 commit comments

Comments
 (0)