Skip to content

Commit e3f0de7

Browse files
authored
Mark some importlib interfaces as deprecated (#13866)
1 parent 8728d93 commit e3f0de7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

stdlib/_frozen_importlib_external.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ def spec_from_file_location(
3636
loader: LoaderProtocol | None = None,
3737
submodule_search_locations: list[str] | None = ...,
3838
) -> importlib.machinery.ModuleSpec | None: ...
39-
39+
@deprecated(
40+
"Deprecated as of Python 3.6: Use site configuration instead. "
41+
"Future versions of Python may not enable this finder by default."
42+
)
4043
class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
4144
if sys.version_info < (3, 12):
4245
@classmethod

stdlib/importlib/abc.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ from importlib import _bootstrap_external
88
from importlib.machinery import ModuleSpec
99
from io import BufferedReader
1010
from typing import IO, Any, Literal, Protocol, overload, runtime_checkable
11+
from typing_extensions import deprecated
1112

1213
if sys.version_info >= (3, 11):
1314
__all__ = [
@@ -38,6 +39,7 @@ else:
3839
if sys.version_info < (3, 12):
3940
class Finder(metaclass=ABCMeta): ...
4041

42+
@deprecated("Deprecated as of Python 3.7: Use importlib.resources.abc.TraversableResources instead.")
4143
class ResourceLoader(Loader):
4244
@abstractmethod
4345
def get_data(self, path: str) -> bytes: ...
@@ -58,6 +60,7 @@ class ExecutionLoader(InspectLoader):
5860
def get_filename(self, fullname: str) -> str: ...
5961

6062
class SourceLoader(_bootstrap_external.SourceLoader, ResourceLoader, ExecutionLoader, metaclass=ABCMeta): # type: ignore[misc] # incompatible definitions of source_to_code in the base classes
63+
@deprecated("Deprecated as of Python 3.3: Use importlib.resources.abc.SourceLoader.path_stats instead.")
6164
def path_mtime(self, path: str) -> float: ...
6265
def set_data(self, path: str, data: bytes) -> None: ...
6366
def get_source(self, fullname: str) -> str | None: ...

0 commit comments

Comments
 (0)