From ac6c61ba04c3d3abf476570de04a9afe7447890b Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Thu, 23 May 2024 16:24:28 -0400 Subject: [PATCH] Stubtest stdlib: unpin 3.11 and 3.12 micro versions (#12022) --- .github/workflows/daily.yml | 3 +- .github/workflows/stubtest_stdlib.yml | 3 +- stdlib/@tests/stubtest_allowlists/py313.txt | 11 -- stdlib/argparse.pyi | 9 ++ stdlib/importlib/metadata/__init__.pyi | 5 +- stdlib/logging/__init__.pyi | 2 +- stdlib/pdb.pyi | 4 +- stdlib/pydoc.pyi | 109 ++++++++++++++------ stdlib/tokenize.pyi | 2 +- 9 files changed, 99 insertions(+), 49 deletions(-) diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 82d8f2906..6d389c57d 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -36,8 +36,7 @@ jobs: matrix: # various modules aren't available on macos-13 and higher os: ["ubuntu-latest", "windows-latest", "macos-12"] - # TODO unpin the 3.11 and 3.12 micro versions - python-version: ["3.8", "3.9", "3.10", "3.11.8", "3.12.2", "3.13"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] fail-fast: false steps: diff --git a/.github/workflows/stubtest_stdlib.yml b/.github/workflows/stubtest_stdlib.yml index d26b4250f..c094f8c0f 100644 --- a/.github/workflows/stubtest_stdlib.yml +++ b/.github/workflows/stubtest_stdlib.yml @@ -32,8 +32,7 @@ jobs: matrix: # various modules aren't available on macos-13 and higher os: ["ubuntu-latest", "windows-latest", "macos-12"] - # TODO unpin 3.11 and 3.12 micro versions - python-version: ["3.8", "3.9", "3.10", "3.11.8", "3.12.2", "3.13"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] fail-fast: false steps: diff --git a/stdlib/@tests/stubtest_allowlists/py313.txt b/stdlib/@tests/stubtest_allowlists/py313.txt index 470ca91f6..6402c18c0 100644 --- a/stdlib/@tests/stubtest_allowlists/py313.txt +++ b/stdlib/@tests/stubtest_allowlists/py313.txt @@ -121,7 +121,6 @@ glob.__all__ glob.translate importlib.metadata.DeprecatedTuple importlib.metadata.Distribution.origin -importlib.metadata.MetadataPathFinder.invalidate_caches importlib.metadata._meta.SimplePath.exists importlib.metadata._meta.SimplePath.read_bytes importlib.metadata._meta.SimplePath.read_text @@ -172,7 +171,6 @@ pdb.Pdb.MAX_CHAINED_EXCEPTION_DEPTH pdb.Pdb.completedefault pdb.Pdb.completenames pdb.Pdb.do_exceptions -pdb.Pdb.execRcLines pdb.Pdb.interaction pdb.Pdb.message pdb.Pdb.user_opcode @@ -182,15 +180,6 @@ platform.android_ver platform.ios_ver pstats.FunctionProfile.__replace__ pstats.StatsProfile.__replace__ -pydoc.HTMLDoc.docdata -pydoc.HTMLDoc.docproperty -pydoc.HTMLDoc.docroutine -pydoc.HTMLDoc.parentlink -pydoc.TextDoc.docdata -pydoc.TextDoc.docmodule -pydoc.TextDoc.docother -pydoc.TextDoc.docproperty -pydoc.TextDoc.docroutine pydoc.pager pydoc.pipepager pydoc.plainpager diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 0898ea816..1956d08c9 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -637,6 +637,15 @@ class _VersionAction(Action): help: str | None = None, deprecated: bool = False, ) -> None: ... + elif sys.version_info >= (3, 11): + def __init__( + self, + option_strings: Sequence[str], + version: str | None = None, + dest: str = "==SUPPRESS==", + default: str = "==SUPPRESS==", + help: str | None = None, + ) -> None: ... else: def __init__( self, diff --git a/stdlib/importlib/metadata/__init__.pyi b/stdlib/importlib/metadata/__init__.pyi index b2fe14777..56ee20523 100644 --- a/stdlib/importlib/metadata/__init__.pyi +++ b/stdlib/importlib/metadata/__init__.pyi @@ -240,7 +240,10 @@ class DistributionFinder(MetaPathFinder): class MetadataPathFinder(DistributionFinder): @classmethod def find_distributions(cls, context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: ... - if sys.version_info >= (3, 10): + if sys.version_info >= (3, 11): + @classmethod + def invalidate_caches(cls) -> None: ... + elif sys.version_info >= (3, 10): # Yes, this is an instance method that has a parameter named "cls" def invalidate_caches(cls) -> None: ... diff --git a/stdlib/logging/__init__.pyi b/stdlib/logging/__init__.pyi index daae70707..8b19444a5 100644 --- a/stdlib/logging/__init__.pyi +++ b/stdlib/logging/__init__.pyi @@ -469,7 +469,7 @@ class LoggerAdapter(Generic[_L]): def getEffectiveLevel(self) -> int: ... def setLevel(self, level: _Level) -> None: ... def hasHandlers(self) -> bool: ... - if sys.version_info >= (3, 13): + if sys.version_info >= (3, 11): def _log( self, level: int, diff --git a/stdlib/pdb.pyi b/stdlib/pdb.pyi index 4cc708d9d..487adddd0 100644 --- a/stdlib/pdb.pyi +++ b/stdlib/pdb.pyi @@ -55,7 +55,9 @@ class Pdb(Bdb, Cmd): ) -> None: ... def forget(self) -> None: ... def setup(self, f: FrameType | None, tb: TracebackType | None) -> None: ... - def execRcLines(self) -> None: ... + if sys.version_info < (3, 11): + def execRcLines(self) -> None: ... + def bp_commands(self, frame: FrameType) -> bool: ... def interaction(self, frame: FrameType | None, traceback: TracebackType | None) -> None: ... def displayhook(self, obj: object) -> None: ... diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 3134de793..1a90eb30e 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -1,5 +1,5 @@ import sys -from _typeshed import OptExcInfo, SupportsWrite +from _typeshed import OptExcInfo, SupportsWrite, Unused from abc import abstractmethod from builtins import list as _list # "list" conflicts with method name from collections.abc import Callable, Container, Mapping, MutableMapping @@ -121,7 +121,7 @@ class HTMLDoc(Doc): def formattree( self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = None ) -> str: ... - def docmodule(self, object: object, name: str | None = None, mod: str | None = None, *ignored: Any) -> str: ... + def docmodule(self, object: object, name: str | None = None, mod: str | None = None, *ignored: Unused) -> str: ... def docclass( self, object: object, @@ -129,22 +129,44 @@ class HTMLDoc(Doc): mod: str | None = None, funcs: Mapping[str, str] = {}, classes: Mapping[str, str] = {}, - *ignored: Any, + *ignored: Unused, ) -> str: ... def formatvalue(self, object: object) -> str: ... - def docroutine( # type: ignore[override] - self, - object: object, - name: str | None = None, - mod: str | None = None, - funcs: Mapping[str, str] = {}, - classes: Mapping[str, str] = {}, - methods: Mapping[str, str] = {}, - cl: type | None = None, - ) -> str: ... - def docproperty(self, object: object, name: str | None = None, mod: str | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] - def docother(self, object: object, name: str | None = None, mod: Any | None = None, *ignored: Any) -> str: ... - def docdata(self, object: object, name: str | None = None, mod: Any | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] + def docother(self, object: object, name: str | None = None, mod: Any | None = None, *ignored: Unused) -> str: ... + if sys.version_info >= (3, 11): + def docroutine( # type: ignore[override] + self, + object: object, + name: str | None = None, + mod: str | None = None, + funcs: Mapping[str, str] = {}, + classes: Mapping[str, str] = {}, + methods: Mapping[str, str] = {}, + cl: type | None = None, + homecls: type | None = None, + ) -> str: ... + def docproperty( + self, object: object, name: str | None = None, mod: str | None = None, cl: Any | None = None, *ignored: Unused + ) -> str: ... + def docdata( + self, object: object, name: str | None = None, mod: Any | None = None, cl: Any | None = None, *ignored: Unused + ) -> str: ... + else: + def docroutine( # type: ignore[override] + self, + object: object, + name: str | None = None, + mod: str | None = None, + funcs: Mapping[str, str] = {}, + classes: Mapping[str, str] = {}, + methods: Mapping[str, str] = {}, + cl: type | None = None, + ) -> str: ... + def docproperty(self, object: object, name: str | None = None, mod: str | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] + def docdata(self, object: object, name: str | None = None, mod: Any | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] + if sys.version_info >= (3, 11): + def parentlink(self, object: type | ModuleType, modname: str) -> str: ... + def index(self, dir: str, shadowed: MutableMapping[str, bool] | None = None) -> str: ... def filelink(self, url: str, path: str) -> str: ... @@ -164,21 +186,48 @@ class TextDoc(Doc): def formattree( self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = None, prefix: str = "" ) -> str: ... - def docmodule(self, object: object, name: str | None = None, mod: Any | None = None) -> str: ... # type: ignore[override] - def docclass(self, object: object, name: str | None = None, mod: str | None = None, *ignored: Any) -> str: ... + def docclass(self, object: object, name: str | None = None, mod: str | None = None, *ignored: Unused) -> str: ... def formatvalue(self, object: object) -> str: ... - def docroutine(self, object: object, name: str | None = None, mod: str | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] - def docproperty(self, object: object, name: str | None = None, mod: Any | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] - def docdata(self, object: object, name: str | None = None, mod: str | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] - def docother( # type: ignore[override] - self, - object: object, - name: str | None = None, - mod: str | None = None, - parent: str | None = None, - maxlen: int | None = None, - doc: Any | None = None, - ) -> str: ... + if sys.version_info >= (3, 11): + def docroutine( # type: ignore[override] + self, + object: object, + name: str | None = None, + mod: str | None = None, + cl: Any | None = None, + homecls: Any | None = None, + ) -> str: ... + def docmodule(self, object: object, name: str | None = None, mod: Any | None = None, *ignored: Unused) -> str: ... + def docproperty( + self, object: object, name: str | None = None, mod: Any | None = None, cl: Any | None = None, *ignored: Unused + ) -> str: ... + def docdata( + self, object: object, name: str | None = None, mod: str | None = None, cl: Any | None = None, *ignored: Unused + ) -> str: ... + def docother( + self, + object: object, + name: str | None = None, + mod: str | None = None, + parent: str | None = None, + *ignored: Unused, + maxlen: int | None = None, + doc: Any | None = None, + ) -> str: ... + else: + def docroutine(self, object: object, name: str | None = None, mod: str | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] + def docmodule(self, object: object, name: str | None = None, mod: Any | None = None) -> str: ... # type: ignore[override] + def docproperty(self, object: object, name: str | None = None, mod: Any | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] + def docdata(self, object: object, name: str | None = None, mod: str | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] + def docother( # type: ignore[override] + self, + object: object, + name: str | None = None, + mod: str | None = None, + parent: str | None = None, + maxlen: int | None = None, + doc: Any | None = None, + ) -> str: ... def pager(text: str) -> None: ... def getpager() -> Callable[[str], None]: ... diff --git a/stdlib/tokenize.pyi b/stdlib/tokenize.pyi index a13b2d4b0..3d2a93865 100644 --- a/stdlib/tokenize.pyi +++ b/stdlib/tokenize.pyi @@ -125,7 +125,7 @@ class Untokenizer: def add_whitespace(self, start: _Position) -> None: ... def untokenize(self, iterable: Iterable[_Token]) -> str: ... def compat(self, token: Sequence[int | str], iterable: Iterable[_Token]) -> None: ... - if sys.version_info >= (3, 13): + if sys.version_info >= (3, 12): def escape_brackets(self, token: str) -> str: ... # the docstring says "returns bytes" but is incorrect --