From 470cd4c04b4ae25d80608ef5914052e7ac43dc08 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 8 Jun 2023 09:56:16 +0300 Subject: [PATCH 1/2] Update pkgutil.pyi for Python3.12 --- stdlib/pkgutil.pyi | 13 +++++++------ tests/stubtest_allowlists/py310.txt | 2 -- tests/stubtest_allowlists/py311.txt | 2 -- tests/stubtest_allowlists/py312.txt | 3 --- tests/stubtest_allowlists/py37.txt | 2 -- tests/stubtest_allowlists/py38.txt | 2 -- tests/stubtest_allowlists/py39.txt | 2 -- 7 files changed, 7 insertions(+), 19 deletions(-) diff --git a/stdlib/pkgutil.pyi b/stdlib/pkgutil.pyi index f9808c9e5de8..59f1f734cf90 100644 --- a/stdlib/pkgutil.pyi +++ b/stdlib/pkgutil.pyi @@ -12,12 +12,12 @@ __all__ = [ "walk_packages", "iter_modules", "get_data", - "ImpImporter", - "ImpLoader", "read_code", "extend_path", "ModuleInfo", ] +if sys.version_info < (3, 12): + __all__ += ["ImpImporter", "ImpLoader"] _PathT = TypeVar("_PathT", bound=Iterable[str]) @@ -28,11 +28,12 @@ class ModuleInfo(NamedTuple): def extend_path(path: _PathT, name: str) -> _PathT: ... -class ImpImporter: - def __init__(self, path: str | None = None) -> None: ... +if sys.version_info < (3, 12): + class ImpImporter: + def __init__(self, path: str | None = None) -> None: ... -class ImpLoader: - def __init__(self, fullname: str, file: IO[str], filename: str, etc: tuple[str, str, int]) -> None: ... + class ImpLoader: + def __init__(self, fullname: str, file: IO[str], filename: str, etc: tuple[str, str, int]) -> None: ... def find_loader(fullname: str) -> Loader | None: ... def get_importer(path_item: str) -> PathEntryFinder | None: ... diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index f68a49e4c783..620f6022caac 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -206,5 +206,3 @@ asyncore.dispatcher.handle_accepted asynchat.async_chat.encoding asynchat.async_chat.use_encoding asynchat.find_prefix_at_end -pkgutil.ImpImporter\..* -pkgutil.ImpLoader\..* diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index 493b5d26172b..57771d95340b 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -169,5 +169,3 @@ asyncore.dispatcher.handle_accepted asynchat.async_chat.encoding asynchat.async_chat.use_encoding asynchat.find_prefix_at_end -pkgutil.ImpImporter\..* -pkgutil.ImpLoader\..* diff --git a/tests/stubtest_allowlists/py312.txt b/tests/stubtest_allowlists/py312.txt index 5df6b7235fc0..c39b4bf657da 100644 --- a/tests/stubtest_allowlists/py312.txt +++ b/tests/stubtest_allowlists/py312.txt @@ -92,9 +92,6 @@ pathlib.PurePath.__init__ pathlib.PurePath.is_relative_to pathlib.PurePath.relative_to pdb.Pdb.set_convenience_variable -pkgutil.ImpImporter -pkgutil.ImpLoader -pkgutil.__all__ poplib.POP3_SSL.__init__ posixpath.__all__ posixpath.isjunction diff --git a/tests/stubtest_allowlists/py37.txt b/tests/stubtest_allowlists/py37.txt index 3a7413858aed..08ace4b91b9c 100644 --- a/tests/stubtest_allowlists/py37.txt +++ b/tests/stubtest_allowlists/py37.txt @@ -182,5 +182,3 @@ asyncore.dispatcher.handle_accepted asynchat.async_chat.encoding asynchat.async_chat.use_encoding asynchat.find_prefix_at_end -pkgutil.ImpImporter\..* -pkgutil.ImpLoader\..* diff --git a/tests/stubtest_allowlists/py38.txt b/tests/stubtest_allowlists/py38.txt index 1e9ca5638c6a..62e2c9ce91db 100644 --- a/tests/stubtest_allowlists/py38.txt +++ b/tests/stubtest_allowlists/py38.txt @@ -200,5 +200,3 @@ asyncore.dispatcher.handle_accepted asynchat.async_chat.encoding asynchat.async_chat.use_encoding asynchat.find_prefix_at_end -pkgutil.ImpImporter\..* -pkgutil.ImpLoader\..* diff --git a/tests/stubtest_allowlists/py39.txt b/tests/stubtest_allowlists/py39.txt index 277efd02f0a6..b27562f40d0e 100644 --- a/tests/stubtest_allowlists/py39.txt +++ b/tests/stubtest_allowlists/py39.txt @@ -198,5 +198,3 @@ asyncore.dispatcher.handle_accepted asynchat.async_chat.encoding asynchat.async_chat.use_encoding asynchat.find_prefix_at_end -pkgutil.ImpImporter\..* -pkgutil.ImpLoader\..* From 095dc26c12aa43d05b51f722081b08170899c4f6 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 8 Jun 2023 10:00:10 +0300 Subject: [PATCH 2/2] No, we still need older ignores --- tests/stubtest_allowlists/py310.txt | 2 ++ tests/stubtest_allowlists/py311.txt | 2 ++ tests/stubtest_allowlists/py37.txt | 2 ++ tests/stubtest_allowlists/py38.txt | 2 ++ tests/stubtest_allowlists/py39.txt | 2 ++ 5 files changed, 10 insertions(+) diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index 620f6022caac..f68a49e4c783 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -206,3 +206,5 @@ asyncore.dispatcher.handle_accepted asynchat.async_chat.encoding asynchat.async_chat.use_encoding asynchat.find_prefix_at_end +pkgutil.ImpImporter\..* +pkgutil.ImpLoader\..* diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index 57771d95340b..493b5d26172b 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -169,3 +169,5 @@ asyncore.dispatcher.handle_accepted asynchat.async_chat.encoding asynchat.async_chat.use_encoding asynchat.find_prefix_at_end +pkgutil.ImpImporter\..* +pkgutil.ImpLoader\..* diff --git a/tests/stubtest_allowlists/py37.txt b/tests/stubtest_allowlists/py37.txt index 08ace4b91b9c..3a7413858aed 100644 --- a/tests/stubtest_allowlists/py37.txt +++ b/tests/stubtest_allowlists/py37.txt @@ -182,3 +182,5 @@ asyncore.dispatcher.handle_accepted asynchat.async_chat.encoding asynchat.async_chat.use_encoding asynchat.find_prefix_at_end +pkgutil.ImpImporter\..* +pkgutil.ImpLoader\..* diff --git a/tests/stubtest_allowlists/py38.txt b/tests/stubtest_allowlists/py38.txt index 62e2c9ce91db..1e9ca5638c6a 100644 --- a/tests/stubtest_allowlists/py38.txt +++ b/tests/stubtest_allowlists/py38.txt @@ -200,3 +200,5 @@ asyncore.dispatcher.handle_accepted asynchat.async_chat.encoding asynchat.async_chat.use_encoding asynchat.find_prefix_at_end +pkgutil.ImpImporter\..* +pkgutil.ImpLoader\..* diff --git a/tests/stubtest_allowlists/py39.txt b/tests/stubtest_allowlists/py39.txt index b27562f40d0e..277efd02f0a6 100644 --- a/tests/stubtest_allowlists/py39.txt +++ b/tests/stubtest_allowlists/py39.txt @@ -198,3 +198,5 @@ asyncore.dispatcher.handle_accepted asynchat.async_chat.encoding asynchat.async_chat.use_encoding asynchat.find_prefix_at_end +pkgutil.ImpImporter\..* +pkgutil.ImpLoader\..*