Skip to content

Commit c7b8fe9

Browse files
Fix stdlib stubtest for latest Python patch releases (#13812)
1 parent 87f599d commit c7b8fe9

File tree

11 files changed

+33
-18
lines changed

11 files changed

+33
-18
lines changed

stdlib/@tests/stubtest_allowlists/darwin-py313.txt

-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,4 @@
22
# >= 3.13
33
# =======
44

5-
# Depends on HAVE_NCURSESW and how we install CPython,
6-
# should be removed when 3.13 will be officially released:
7-
_?curses.unget_wch
8-
_?curses.window.get_wch
9-
105
(mmap.MAP_32BIT)? # Exists locally on MacOS but not on GitHub

stdlib/@tests/stubtest_allowlists/py310.txt

+5
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,8 @@ sunau.Au_write.initfp
290290
threading.Lock # Factory function at runtime, but that wouldn't let us use it in type hints
291291
types.SimpleNamespace.__init__ # class doesn't accept positional arguments but has default C signature
292292
typing_extensions\.Annotated # Undocumented implementation details
293+
294+
# Incompatible changes introduced in Python 3.10.17
295+
# (Remove once 3.10.17 becomes available for all platforms)
296+
(email._header_value_parser.get_encoded_word)?
297+
(email._header_value_parser.make_quoted_pairs)?

stdlib/@tests/stubtest_allowlists/py311.txt

+5
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,8 @@ sunau.Au_write.initfp
254254
threading.Lock # Factory function at runtime, but that wouldn't let us use it in type hints
255255
types.SimpleNamespace.__init__ # class doesn't accept positional arguments but has default C signature
256256
typing_extensions\.Annotated # Undocumented implementation details
257+
258+
# Incompatible changes introduced in Python 3.11.12
259+
# (Remove once 3.11.12 becomes available for all platforms)
260+
(email._header_value_parser.get_encoded_word)?
261+
(email._header_value_parser.make_quoted_pairs)?

stdlib/@tests/stubtest_allowlists/py39.txt

+4
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,7 @@ sunau.Au_write.initfp
241241
threading.Lock # Factory function at runtime, but that wouldn't let us use it in type hints
242242
types.SimpleNamespace.__init__ # class doesn't accept positional arguments but has default C signature
243243
typing_extensions\.Annotated # Undocumented implementation details
244+
245+
# Incompatible changes introduced in Python 3.9.22
246+
# (Remove once 3.9.22 becomes available for all platforms)
247+
(email._header_value_parser.get_encoded_word)?

stdlib/_curses.pyi

+8-7
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,14 @@ BUTTON4_DOUBLE_CLICKED: int
9595
BUTTON4_PRESSED: int
9696
BUTTON4_RELEASED: int
9797
BUTTON4_TRIPLE_CLICKED: int
98-
# Darwin ncurses doesn't provide BUTTON5_* constants
99-
if sys.version_info >= (3, 10) and sys.platform != "darwin":
100-
BUTTON5_PRESSED: int
101-
BUTTON5_RELEASED: int
102-
BUTTON5_CLICKED: int
103-
BUTTON5_DOUBLE_CLICKED: int
104-
BUTTON5_TRIPLE_CLICKED: int
98+
# Darwin ncurses doesn't provide BUTTON5_* constants prior to 3.12.10 and 3.13.3
99+
if sys.version_info >= (3, 10):
100+
if sys.version_info >= (3, 12) or sys.platform != "darwin":
101+
BUTTON5_PRESSED: int
102+
BUTTON5_RELEASED: int
103+
BUTTON5_CLICKED: int
104+
BUTTON5_DOUBLE_CLICKED: int
105+
BUTTON5_TRIPLE_CLICKED: int
105106
BUTTON_ALT: int
106107
BUTTON_CTRL: int
107108
BUTTON_SHIFT: int

stdlib/_socket.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ if sys.platform == "win32":
7878
SO_EXCLUSIVEADDRUSE: int
7979
if sys.platform != "win32":
8080
SO_REUSEPORT: int
81-
if sys.platform != "darwin":
81+
if sys.platform != "darwin" or sys.version_info >= (3, 13):
8282
SO_BINDTODEVICE: int
8383

8484
if sys.platform != "win32" and sys.platform != "darwin":

stdlib/email/_header_value_parser.pyi

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ NLSET: Final[set[str]]
2222
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
2323
SPECIALSNL: Final[set[str]]
2424

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

2829
def quote_string(value: Any) -> str: ...
@@ -349,7 +350,7 @@ ListSeparator: Final[ValueTerminal]
349350
RouteComponentMarker: Final[ValueTerminal]
350351

351352
def get_fws(value: str) -> tuple[WhiteSpaceTerminal, str]: ...
352-
def get_encoded_word(value: str) -> tuple[EncodedWord, str]: ...
353+
def get_encoded_word(value: str, terminal_type: str = "vtext") -> tuple[EncodedWord, str]: ...
353354
def get_unstructured(value: str) -> UnstructuredTokenList: ...
354355
def get_qp_ctext(value: str) -> tuple[WhiteSpaceTerminal, str]: ...
355356
def get_qcontent(value: str) -> tuple[ValueTerminal, str]: ...

stdlib/importlib/resources/__init__.pyi

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ if sys.version_info < (3, 11):
3737
elif sys.version_info < (3, 13):
3838
Resource: TypeAlias = str
3939

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

4343
__all__ += ["Anchor"]
4444

45+
if sys.version_info >= (3, 13):
4546
from importlib.resources._functional import (
4647
contents as contents,
4748
is_resource as is_resource,

stdlib/multiprocessing/resource_tracker.pyi

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from _typeshed import FileDescriptorOrPath
23
from collections.abc import Sized
34

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

1215
_resource_tracker: ResourceTracker
1316
ensure_running = _resource_tracker.ensure_running

stdlib/socket.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ if sys.platform != "win32":
514514
"IPV6_RTHDRDSTOPTS",
515515
]
516516

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

520520
__all__ += ["SO_BINDTODEVICE"]

stdlib/tokenize.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class Untokenizer:
125125
prev_col: int
126126
encoding: str | None
127127
def add_whitespace(self, start: _Position) -> None: ...
128-
if sys.version_info >= (3, 13):
128+
if sys.version_info >= (3, 12):
129129
def add_backslash_continuation(self, start: _Position) -> None: ...
130130

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

0 commit comments

Comments
 (0)