Skip to content

Commit 23bb049

Browse files
authored
Update pkgutil.pyi for Python3.12 (#10281)
1 parent d778855 commit 23bb049

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

stdlib/pkgutil.pyi

+7-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ __all__ = [
1212
"walk_packages",
1313
"iter_modules",
1414
"get_data",
15-
"ImpImporter",
16-
"ImpLoader",
1715
"read_code",
1816
"extend_path",
1917
"ModuleInfo",
2018
]
19+
if sys.version_info < (3, 12):
20+
__all__ += ["ImpImporter", "ImpLoader"]
2121

2222
_PathT = TypeVar("_PathT", bound=Iterable[str])
2323

@@ -28,11 +28,12 @@ class ModuleInfo(NamedTuple):
2828

2929
def extend_path(path: _PathT, name: str) -> _PathT: ...
3030

31-
class ImpImporter:
32-
def __init__(self, path: str | None = None) -> None: ...
31+
if sys.version_info < (3, 12):
32+
class ImpImporter:
33+
def __init__(self, path: str | None = None) -> None: ...
3334

34-
class ImpLoader:
35-
def __init__(self, fullname: str, file: IO[str], filename: str, etc: tuple[str, str, int]) -> None: ...
35+
class ImpLoader:
36+
def __init__(self, fullname: str, file: IO[str], filename: str, etc: tuple[str, str, int]) -> None: ...
3637

3738
def find_loader(fullname: str) -> Loader | None: ...
3839
def get_importer(path_item: str) -> PathEntryFinder | None: ...

tests/stubtest_allowlists/py312.txt

-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ pathlib.PurePath.__init__
9191
pathlib.PurePath.is_relative_to
9292
pathlib.PurePath.relative_to
9393
pdb.Pdb.set_convenience_variable
94-
pkgutil.ImpImporter
95-
pkgutil.ImpLoader
96-
pkgutil.__all__
9794
poplib.POP3_SSL.__init__
9895
posixpath.__all__
9996
posixpath.isjunction

0 commit comments

Comments
 (0)