From b083859d01c01b16b25995f10450a18286ee9a92 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 24 Oct 2024 15:02:36 +0200 Subject: [PATCH 1/6] [CI] Switch to macos-latest macos-12 is deprecated and will be removed: https://github.com/actions/runner-images/issues/10721 --- .github/workflows/daily.yml | 3 +-- .github/workflows/stubtest_stdlib.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index d519cbc6168c..0abd07732e88 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -34,8 +34,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - # various modules aren't available on macos-13 and higher - os: ["ubuntu-latest", "windows-latest", "macos-12"] + os: ["ubuntu-latest", "windows-latest", "macos-latest"] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] fail-fast: false diff --git a/.github/workflows/stubtest_stdlib.yml b/.github/workflows/stubtest_stdlib.yml index 795eef7e793d..7224f0ea6380 100644 --- a/.github/workflows/stubtest_stdlib.yml +++ b/.github/workflows/stubtest_stdlib.yml @@ -30,8 +30,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - # various modules aren't available on macos-13 and higher - os: ["ubuntu-latest", "windows-latest", "macos-12"] + os: ["ubuntu-latest", "windows-latest", "macos-latest"] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] fail-fast: false From 8c85a010d1d91d2117ea54d60350b5c84df1355c Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 24 Oct 2024 15:12:31 +0200 Subject: [PATCH 2/6] Move some allowlist entries to general darwin.txt --- stdlib/@tests/stubtest_allowlists/darwin-py311.txt | 13 ------------- stdlib/@tests/stubtest_allowlists/darwin-py312.txt | 13 ------------- stdlib/@tests/stubtest_allowlists/darwin-py313.txt | 13 ------------- stdlib/@tests/stubtest_allowlists/darwin.txt | 13 +++++++++++++ 4 files changed, 13 insertions(+), 39 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py311.txt b/stdlib/@tests/stubtest_allowlists/darwin-py311.txt index e888a011c0f7..b030d8307760 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py311.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py311.txt @@ -1,14 +1,5 @@ webbrowser.MacOSX.__init__ -# These entries looks like a `setup-python` bug: -(dbm.gnu)? -(_?locale.bind_textdomain_codeset)? -(_?locale.bindtextdomain)? -(_?locale.dcgettext)? -(_?locale.dgettext)? -(_?locale.gettext)? -(_?locale.textdomain)? - # Doesn't exist on macos: spwd _msi @@ -27,7 +18,3 @@ email._header_value_parser.SPECIALSNL email.errors.HeaderWriteError email.utils.getaddresses email.utils.parseaddr - -# not available on python distributions compiled without sqlite3 loadable extension support -_sqlite3.Connection.load_extension -_sqlite3.Connection.enable_load_extension diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py312.txt b/stdlib/@tests/stubtest_allowlists/darwin-py312.txt index c16cba0a8aed..a70a534bfe43 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py312.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py312.txt @@ -1,14 +1,5 @@ webbrowser.MacOSX.__init__ -# These entries looks like a `setup-python` bug: -(dbm.gnu)? -(_?locale.bind_textdomain_codeset)? -(_?locale.bindtextdomain)? -(_?locale.dcgettext)? -(_?locale.dgettext)? -(_?locale.gettext)? -(_?locale.textdomain)? - # Doesn't exist on macos: spwd _msi @@ -19,7 +10,3 @@ ossaudiodev fcntl.F_OFD_GETLK fcntl.F_OFD_SETLK fcntl.F_OFD_SETLKW - -# not available on python distributions compiled without sqlite3 loadable extension support -_sqlite3.Connection.load_extension -_sqlite3.Connection.enable_load_extension diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py313.txt b/stdlib/@tests/stubtest_allowlists/darwin-py313.txt index 285d1d3ed0e8..0faf75d4eacc 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py313.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py313.txt @@ -8,16 +8,3 @@ _?curses.window.get_wch # Exists locally on MacOS but not on GitHub (mmap.MAP_32BIT)? - -# These entries looks like a `setup-python` bug: -(dbm.gnu)? -(_?locale.bind_textdomain_codeset)? -(_?locale.bindtextdomain)? -(_?locale.dcgettext)? -(_?locale.dgettext)? -(_?locale.gettext)? -(_?locale.textdomain)? - -# not available on python distributions compiled without sqlite3 loadable extension support -_sqlite3.Connection.load_extension -_sqlite3.Connection.enable_load_extension diff --git a/stdlib/@tests/stubtest_allowlists/darwin.txt b/stdlib/@tests/stubtest_allowlists/darwin.txt index 07f013c0cf62..8696aecdde88 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin.txt @@ -61,3 +61,16 @@ curses.COLORS # Initialized after start_color curses.COLOR_PAIRS # Initialized after start_color curses.COLS # Initialized only after initscr call curses.LINES # Initialized only after initscr call + +# These entries looks like a `setup-python` bug: +(dbm.gnu)? +(_?locale.bind_textdomain_codeset)? +(_?locale.bindtextdomain)? +(_?locale.dcgettext)? +(_?locale.dgettext)? +(_?locale.gettext)? +(_?locale.textdomain)? + +# Not available on python distributions compiled without sqlite3 loadable extension support +_sqlite3.Connection.load_extension +_sqlite3.Connection.enable_load_extension From 9829ca77f3c3297330047e0aa48f704086ef89bd Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 24 Oct 2024 15:23:58 +0200 Subject: [PATCH 3/6] Add some allowlist entries added in patch versions --- stdlib/@tests/stubtest_allowlists/darwin-py310.txt | 3 +++ stdlib/@tests/stubtest_allowlists/darwin-py38.txt | 7 +++++++ stdlib/@tests/stubtest_allowlists/darwin-py39.txt | 7 +++++++ stdlib/@tests/stubtest_allowlists/win32-py310.txt | 1 + stdlib/@tests/stubtest_allowlists/win32-py38.txt | 1 + stdlib/@tests/stubtest_allowlists/win32-py39.txt | 1 + 6 files changed, 20 insertions(+) diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py310.txt b/stdlib/@tests/stubtest_allowlists/darwin-py310.txt index 3a1e4d21dd05..e6f178faa1af 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py310.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py310.txt @@ -5,3 +5,6 @@ spwd _msi msilib(.[a-z]+)? ossaudiodev + +# Added in Python 3.10.12 +tarfile.TarInfo.replace diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py38.txt b/stdlib/@tests/stubtest_allowlists/darwin-py38.txt index 3a1e4d21dd05..c629fbfc038e 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py38.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py38.txt @@ -5,3 +5,10 @@ spwd _msi msilib(.[a-z]+)? ossaudiodev + +# Added in Python 3.8.14 +def set_int_max_str_digits(maxdigits: int) -> None: ... +def get_int_max_str_digits() -> int: ... + +# Added in Python 3.8.17 +tarfile.TarInfo.replace diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py39.txt b/stdlib/@tests/stubtest_allowlists/darwin-py39.txt index 3a1e4d21dd05..1bcaa0dea2e6 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py39.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py39.txt @@ -5,3 +5,10 @@ spwd _msi msilib(.[a-z]+)? ossaudiodev + +# Added in Python 3.9.14 +def set_int_max_str_digits(maxdigits: int) -> None: ... +def get_int_max_str_digits() -> int: ... + +# Added in Python 3.9.17 +tarfile.TarInfo.replace diff --git a/stdlib/@tests/stubtest_allowlists/win32-py310.txt b/stdlib/@tests/stubtest_allowlists/win32-py310.txt index e9b0b2d5c29b..4965548c93ed 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py310.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py310.txt @@ -1,3 +1,4 @@ +# Added in Python 3.10.12 tarfile.TarInfo.replace # pathlib methods that exist on Windows, but always raise NotImplementedError, diff --git a/stdlib/@tests/stubtest_allowlists/win32-py38.txt b/stdlib/@tests/stubtest_allowlists/win32-py38.txt index 4f10b78af53a..aa003e82b997 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py38.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py38.txt @@ -1,3 +1,4 @@ +# Added in Python 3.8.17 tarfile.TarInfo.replace # ========== diff --git a/stdlib/@tests/stubtest_allowlists/win32-py39.txt b/stdlib/@tests/stubtest_allowlists/win32-py39.txt index e1154c3e6c9b..a81b7e710118 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py39.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py39.txt @@ -1,3 +1,4 @@ +# Added in Python 3.9.17 tarfile.TarInfo.replace # pathlib methods that exist on Windows, but always raise NotImplementedError, From 83d88d75ce3bf960c18e2d5376530c209230ab15 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:25:31 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/@tests/test_cases/check_os_path.py | 3 ++- stdlib/ast.pyi | 1 - stdlib/warnings.pyi | 2 +- stubs/netifaces/netifaces.pyi | 2 +- .../test_cases/check_nested_descriptors.py | 16 ++++------------ 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/stdlib/@tests/test_cases/check_os_path.py b/stdlib/@tests/test_cases/check_os_path.py index aeec873fbef0..bd6911ed3cc9 100644 --- a/stdlib/@tests/test_cases/check_os_path.py +++ b/stdlib/@tests/test_cases/check_os_path.py @@ -1,9 +1,10 @@ from __future__ import annotations + from _typeshed import StrOrBytesPath from os import PathLike from os.path import abspath, expanduser, expandvars -from typing_extensions import assert_type from typing import AnyStr, Union +from typing_extensions import assert_type def test_str_path(str_path: StrOrBytesPath) -> None: diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index e6be9038ba22..351a4af2fb75 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -2036,7 +2036,6 @@ class NodeVisitor: @deprecated("Replaced by visit_Constant; removed in Python 3.14") def visit_Ellipsis(self, node: Ellipsis) -> Any: ... # type: ignore[deprecated] - class NodeTransformer(NodeVisitor): def generic_visit(self, node: AST) -> AST: ... # TODO: Override the visit_* methods with better return types. diff --git a/stdlib/warnings.pyi b/stdlib/warnings.pyi index fa37018b57a5..533a36817506 100644 --- a/stdlib/warnings.pyi +++ b/stdlib/warnings.pyi @@ -1,5 +1,5 @@ -import sys import re +import sys from _warnings import warn as warn, warn_explicit as warn_explicit from collections.abc import Sequence from types import ModuleType, TracebackType diff --git a/stubs/netifaces/netifaces.pyi b/stubs/netifaces/netifaces.pyi index 104ab384e1fa..fa146c35761c 100644 --- a/stubs/netifaces/netifaces.pyi +++ b/stubs/netifaces/netifaces.pyi @@ -1,4 +1,4 @@ -from typing import Literal, Final +from typing import Final, Literal AF_12844: Final[int] AF_APPLETALK: Final[int] diff --git a/stubs/openpyxl/@tests/test_cases/check_nested_descriptors.py b/stubs/openpyxl/@tests/test_cases/check_nested_descriptors.py index 301d519f03f1..e28920ed8c83 100644 --- a/stubs/openpyxl/@tests/test_cases/check_nested_descriptors.py +++ b/stubs/openpyxl/@tests/test_cases/check_nested_descriptors.py @@ -304,15 +304,9 @@ class WithDescriptorsStrict(Strict): with_descriptors.text_int_not_none = None # type: ignore with_descriptors.text_int_not_none = object() # type: ignore # If expected type (_T) is not str, it's impossible to use an Element as the value -with_descriptors.text_int_not_none = cast( # type: ignore - _HasTagAndGet[int], _ -) -with_descriptors.text_int_not_none = cast( # type: ignore - _HasTagAndGet[None], _ -) -with_descriptors.text_int_not_none = cast( # type: ignore - _HasTagAndGet[str], _ -) +with_descriptors.text_int_not_none = cast(_HasTagAndGet[int], _) # type: ignore +with_descriptors.text_int_not_none = cast(_HasTagAndGet[None], _) # type: ignore +with_descriptors.text_int_not_none = cast(_HasTagAndGet[str], _) # type: ignore with_descriptors.text_int_none = 0 with_descriptors.text_int_none = "0" @@ -336,9 +330,7 @@ class WithDescriptorsStrict(Strict): with_descriptors.minmax_float = None # type: ignore with_descriptors.minmax_float = object() # type: ignore with_descriptors.minmax_float = cast(_HasTagAndGet[float], _) -with_descriptors.minmax_float = cast( # type: ignore - _HasTagAndGet[None], _ -) +with_descriptors.minmax_float = cast(_HasTagAndGet[None], _) # type: ignore with_descriptors.minmax_float = cast(_HasTagAndGet[object], _) # type: ignore with_descriptors.minmax_float_none = 0 From 90fd91536033c3f4ffcc9d9835e25b688acee6fd Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Thu, 24 Oct 2024 14:39:16 +0100 Subject: [PATCH 5/6] fix stubtest issues --- stdlib/@tests/stubtest_allowlists/darwin-py38.txt | 4 ++-- stdlib/@tests/stubtest_allowlists/darwin-py39.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py38.txt b/stdlib/@tests/stubtest_allowlists/darwin-py38.txt index c629fbfc038e..142bbf53787e 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py38.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py38.txt @@ -7,8 +7,8 @@ msilib(.[a-z]+)? ossaudiodev # Added in Python 3.8.14 -def set_int_max_str_digits(maxdigits: int) -> None: ... -def get_int_max_str_digits() -> int: ... +sys.set_int_max_str_digits +sys.get_int_max_str_digits # Added in Python 3.8.17 tarfile.TarInfo.replace diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py39.txt b/stdlib/@tests/stubtest_allowlists/darwin-py39.txt index 1bcaa0dea2e6..f5bcb064f35d 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py39.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py39.txt @@ -7,8 +7,8 @@ msilib(.[a-z]+)? ossaudiodev # Added in Python 3.9.14 -def set_int_max_str_digits(maxdigits: int) -> None: ... -def get_int_max_str_digits() -> int: ... +sys.set_int_max_str_digits +sys.get_int_max_str_digits # Added in Python 3.9.17 tarfile.TarInfo.replace From cf7af19be27ced8303c0f314761714b5bf246529 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 24 Oct 2024 16:50:10 +0200 Subject: [PATCH 6/6] Update allowlists --- stdlib/@tests/stubtest_allowlists/darwin-py310.txt | 7 +++++++ stdlib/@tests/stubtest_allowlists/darwin-py39.txt | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py310.txt b/stdlib/@tests/stubtest_allowlists/darwin-py310.txt index e6f178faa1af..a85cdd09aa0f 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py310.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py310.txt @@ -8,3 +8,10 @@ ossaudiodev # Added in Python 3.10.12 tarfile.TarInfo.replace + +# Added in Python 3.10.15 +email._header_value_parser.NLSET +email._header_value_parser.SPECIALSNL +email.errors.HeaderWriteError +email.utils.getaddresses +email.utils.parseaddr diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py39.txt b/stdlib/@tests/stubtest_allowlists/darwin-py39.txt index f5bcb064f35d..34333c509515 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py39.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py39.txt @@ -12,3 +12,10 @@ sys.get_int_max_str_digits # Added in Python 3.9.17 tarfile.TarInfo.replace + +# Added in Python 3.9.20 +email._header_value_parser.NLSET +email._header_value_parser.SPECIALSNL +email.errors.HeaderWriteError +email.utils.getaddresses +email.utils.parseaddr