Skip to content

Fix stdlib stubtest for latest Python patch releases #13812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions stdlib/@tests/stubtest_allowlists/darwin-py313.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@
# >= 3.13
# =======

# Depends on HAVE_NCURSESW and how we install CPython,
# should be removed when 3.13 will be officially released:
_?curses.unget_wch
_?curses.window.get_wch

(mmap.MAP_32BIT)? # Exists locally on MacOS but not on GitHub
5 changes: 5 additions & 0 deletions stdlib/@tests/stubtest_allowlists/py310.txt
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,8 @@ sunau.Au_write.initfp
threading.Lock # Factory function at runtime, but that wouldn't let us use it in type hints
types.SimpleNamespace.__init__ # class doesn't accept positional arguments but has default C signature
typing_extensions\.Annotated # Undocumented implementation details

# Incompatible changes introduced in Python 3.10.17
# (Remove once 3.10.17 becomes available for all platforms)
(email._header_value_parser.get_encoded_word)?
(email._header_value_parser.make_quoted_pairs)?
5 changes: 5 additions & 0 deletions stdlib/@tests/stubtest_allowlists/py311.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,8 @@ sunau.Au_write.initfp
threading.Lock # Factory function at runtime, but that wouldn't let us use it in type hints
types.SimpleNamespace.__init__ # class doesn't accept positional arguments but has default C signature
typing_extensions\.Annotated # Undocumented implementation details

# Incompatible changes introduced in Python 3.11.12
# (Remove once 3.11.12 becomes available for all platforms)
(email._header_value_parser.get_encoded_word)?
(email._header_value_parser.make_quoted_pairs)?
4 changes: 4 additions & 0 deletions stdlib/@tests/stubtest_allowlists/py39.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,7 @@ sunau.Au_write.initfp
threading.Lock # Factory function at runtime, but that wouldn't let us use it in type hints
types.SimpleNamespace.__init__ # class doesn't accept positional arguments but has default C signature
typing_extensions\.Annotated # Undocumented implementation details

# Incompatible changes introduced in Python 3.9.22
# (Remove once 3.9.22 becomes available for all platforms)
(email._header_value_parser.get_encoded_word)?
15 changes: 8 additions & 7 deletions stdlib/_curses.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ BUTTON4_DOUBLE_CLICKED: int
BUTTON4_PRESSED: int
BUTTON4_RELEASED: int
BUTTON4_TRIPLE_CLICKED: int
# Darwin ncurses doesn't provide BUTTON5_* constants
if sys.version_info >= (3, 10) and sys.platform != "darwin":
BUTTON5_PRESSED: int
BUTTON5_RELEASED: int
BUTTON5_CLICKED: int
BUTTON5_DOUBLE_CLICKED: int
BUTTON5_TRIPLE_CLICKED: int
# Darwin ncurses doesn't provide BUTTON5_* constants prior to 3.12.10 and 3.13.3
if sys.version_info >= (3, 10):
if sys.version_info >= (3, 12) or sys.platform != "darwin":
BUTTON5_PRESSED: int
BUTTON5_RELEASED: int
BUTTON5_CLICKED: int
BUTTON5_DOUBLE_CLICKED: int
BUTTON5_TRIPLE_CLICKED: int
BUTTON_ALT: int
BUTTON_CTRL: int
BUTTON_SHIFT: int
Expand Down
2 changes: 1 addition & 1 deletion stdlib/_socket.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if sys.platform == "win32":
SO_EXCLUSIVEADDRUSE: int
if sys.platform != "win32":
SO_REUSEPORT: int
if sys.platform != "darwin":
if sys.platform != "darwin" or sys.version_info >= (3, 13):
SO_BINDTODEVICE: int

if sys.platform != "win32" and sys.platform != "darwin":
Expand Down
5 changes: 3 additions & 2 deletions stdlib/email/_header_value_parser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ NLSET: Final[set[str]]
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
SPECIALSNL: Final[set[str]]

if sys.version_info >= (3, 12):
if sys.version_info >= (3, 10):
# Added in Python 3.10.17, 3.11.12, 3.12.9, 3.13.2 (may still be backported to 3.9)
def make_quoted_pairs(value: Any) -> str: ...

def quote_string(value: Any) -> str: ...
Expand Down Expand Up @@ -349,7 +350,7 @@ ListSeparator: Final[ValueTerminal]
RouteComponentMarker: Final[ValueTerminal]

def get_fws(value: str) -> tuple[WhiteSpaceTerminal, str]: ...
def get_encoded_word(value: str) -> tuple[EncodedWord, str]: ...
def get_encoded_word(value: str, terminal_type: str = "vtext") -> tuple[EncodedWord, str]: ...
def get_unstructured(value: str) -> UnstructuredTokenList: ...
def get_qp_ctext(value: str) -> tuple[WhiteSpaceTerminal, str]: ...
def get_qcontent(value: str) -> tuple[ValueTerminal, str]: ...
Expand Down
3 changes: 2 additions & 1 deletion stdlib/importlib/resources/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ if sys.version_info < (3, 11):
elif sys.version_info < (3, 13):
Resource: TypeAlias = str

if sys.version_info >= (3, 13):
if sys.version_info >= (3, 12):
from importlib.resources._common import Anchor as Anchor

__all__ += ["Anchor"]

if sys.version_info >= (3, 13):
from importlib.resources._functional import (
contents as contents,
is_resource as is_resource,
Expand Down
3 changes: 3 additions & 0 deletions stdlib/multiprocessing/resource_tracker.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from _typeshed import FileDescriptorOrPath
from collections.abc import Sized

Expand All @@ -8,6 +9,8 @@ class ResourceTracker:
def ensure_running(self) -> None: ...
def register(self, name: Sized, rtype: str) -> None: ...
def unregister(self, name: Sized, rtype: str) -> None: ...
if sys.version_info >= (3, 12):
def __del__(self) -> None: ...

_resource_tracker: ResourceTracker
ensure_running = _resource_tracker.ensure_running
Expand Down
2 changes: 1 addition & 1 deletion stdlib/socket.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ if sys.platform != "win32":
"IPV6_RTHDRDSTOPTS",
]

if sys.platform != "darwin":
if sys.platform != "darwin" or sys.version_info >= (3, 13):
from _socket import SO_BINDTODEVICE as SO_BINDTODEVICE

__all__ += ["SO_BINDTODEVICE"]
Expand Down
2 changes: 1 addition & 1 deletion stdlib/tokenize.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Untokenizer:
prev_col: int
encoding: str | None
def add_whitespace(self, start: _Position) -> None: ...
if sys.version_info >= (3, 13):
if sys.version_info >= (3, 12):
def add_backslash_continuation(self, start: _Position) -> None: ...

def untokenize(self, iterable: Iterable[_Token]) -> str: ...
Expand Down