Skip to content

Commit 5caaf2e

Browse files
authored
Fix stdlib stubtest for latest Python patch releases (#13464)
1 parent aac4394 commit 5caaf2e

File tree

12 files changed

+28
-5
lines changed

12 files changed

+28
-5
lines changed

stdlib/@tests/stubtest_allowlists/common.txt

-1
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,6 @@ unittest.runner._WritelnDecorator.flush # Methods that come from __getattr__()
537537
unittest.runner._WritelnDecorator.write # Methods that come from __getattr__() at runtime
538538
urllib.response.addbase.write # Methods that come from __getattr__() at runtime
539539
urllib.response.addbase.writelines # Methods that come from __getattr__() at runtime
540-
urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to super, so super args are specified
541540
unittest.mock.patch # function with attributes, which we approximate with a callable class
542541

543542
_?weakref\.CallableProxyType\.__getattr__ # Should have all attributes of proxy

stdlib/@tests/stubtest_allowlists/py310.txt

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ _?bz2.BZ2Decompressor.__init__ # function does not accept parameters but C sign
108108
configparser.ParsingError.filename
109109
enum.Enum._generate_next_value_
110110
importlib.abc.Finder.find_module
111+
urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to super, so super args are specified
111112
xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
112113
xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
113114

stdlib/@tests/stubtest_allowlists/py311.txt

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ _?bz2.BZ2Decompressor.__init__ # function does not accept parameters but C sign
7575
configparser.ParsingError.filename
7676
enum.Enum._generate_next_value_
7777
importlib.abc.Finder.find_module
78+
urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to super, so super args are specified
7879
xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
7980
xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
8081

stdlib/@tests/stubtest_allowlists/py39.txt

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ _?bz2.BZ2Decompressor.__init__ # function does not accept parameters but C sign
7575
configparser.ParsingError.filename
7676
enum.Enum._generate_next_value_
7777
importlib.abc.Finder.find_module
78+
urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to super, so super args are specified
7879
xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
7980
xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
8081

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" or sys.version_info >= (3, 13):
81+
if sys.platform != "darwin":
8282
SO_BINDTODEVICE: int
8383

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

stdlib/bdb.pyi

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22
from _typeshed import ExcInfo, TraceFunction, Unused
3-
from collections.abc import Callable, Iterable, Mapping
3+
from collections.abc import Callable, Iterable, Iterator, Mapping
4+
from contextlib import contextmanager
45
from types import CodeType, FrameType, TracebackType
56
from typing import IO, Any, Final, SupportsInt, TypeVar
67
from typing_extensions import ParamSpec
@@ -30,6 +31,10 @@ class Bdb:
3031
def __init__(self, skip: Iterable[str] | None = None) -> None: ...
3132
def canonic(self, filename: str) -> str: ...
3233
def reset(self) -> None: ...
34+
if sys.version_info >= (3, 12):
35+
@contextmanager
36+
def set_enterframe(self, frame: FrameType) -> Iterator[None]: ...
37+
3338
def trace_dispatch(self, frame: FrameType, event: str, arg: Any) -> TraceFunction: ...
3439
def dispatch_line(self, frame: FrameType) -> TraceFunction: ...
3540
def dispatch_call(self, frame: FrameType, arg: None) -> TraceFunction: ...

stdlib/email/_header_value_parser.pyi

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from collections.abc import Iterable, Iterator
23
from email.errors import HeaderParseError, MessageDefect
34
from email.policy import Policy
@@ -21,6 +22,9 @@ NLSET: Final[set[str]]
2122
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
2223
SPECIALSNL: Final[set[str]]
2324

25+
if sys.version_info >= (3, 12):
26+
def make_quoted_pairs(value: Any) -> str: ...
27+
2428
def quote_string(value: Any) -> str: ...
2529

2630
rfc2047_matcher: Pattern[str]

stdlib/enum.pyi

+5-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ if sys.version_info >= (3, 11):
6464
def __init__(self, value: _EnumMemberT) -> None: ...
6565

6666
class _EnumDict(dict[str, Any]):
67-
def __init__(self) -> None: ...
67+
if sys.version_info >= (3, 13):
68+
def __init__(self, cls_name: str | None = None) -> None: ...
69+
else:
70+
def __init__(self) -> None: ...
71+
6872
def __setitem__(self, key: str, value: Any) -> None: ...
6973
if sys.version_info >= (3, 11):
7074
# See comment above `typing.MutableMapping.update`

stdlib/os/__init__.pyi

+4
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ if sys.platform == "linux" and sys.version_info >= (3, 12):
240240
"CLONE_VM",
241241
"setns",
242242
"unshare",
243+
"PIDFD_NONBLOCK",
243244
]
244245
if sys.platform == "linux" and sys.version_info >= (3, 10):
245246
__all__ += [
@@ -1603,6 +1604,9 @@ if sys.version_info >= (3, 9):
16031604
if sys.platform == "linux":
16041605
def pidfd_open(pid: int, flags: int = ...) -> int: ...
16051606

1607+
if sys.version_info >= (3, 12) and sys.platform == "linux":
1608+
PIDFD_NONBLOCK: Final = 2048
1609+
16061610
if sys.version_info >= (3, 12) and sys.platform == "win32":
16071611
def listdrives() -> list[str]: ...
16081612
def listmounts(volume: str) -> list[str]: ...

stdlib/posix.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ if sys.platform != "win32":
379379
CLONE_SYSVSEM as CLONE_SYSVSEM,
380380
CLONE_THREAD as CLONE_THREAD,
381381
CLONE_VM as CLONE_VM,
382+
PIDFD_NONBLOCK as PIDFD_NONBLOCK,
382383
setns as setns,
383384
unshare as unshare,
384385
)

stdlib/socket.pyi

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

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

521521
__all__ += ["SO_BINDTODEVICE"]

stdlib/tokenize.pyi

+3
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ 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):
129+
def add_backslash_continuation(self, start: _Position) -> None: ...
130+
128131
def untokenize(self, iterable: Iterable[_Token]) -> str: ...
129132
def compat(self, token: Sequence[int | str], iterable: Iterable[_Token]) -> None: ...
130133
if sys.version_info >= (3, 12):

0 commit comments

Comments
 (0)