diff --git a/stdlib/@tests/stubtest_allowlists/common.txt b/stdlib/@tests/stubtest_allowlists/common.txt index 12d2cbc8b16b..f5d74200e417 100644 --- a/stdlib/@tests/stubtest_allowlists/common.txt +++ b/stdlib/@tests/stubtest_allowlists/common.txt @@ -537,7 +537,6 @@ unittest.runner._WritelnDecorator.flush # Methods that come from __getattr__() unittest.runner._WritelnDecorator.write # Methods that come from __getattr__() at runtime urllib.response.addbase.write # Methods that come from __getattr__() at runtime urllib.response.addbase.writelines # Methods that come from __getattr__() at runtime -urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to super, so super args are specified unittest.mock.patch # function with attributes, which we approximate with a callable class _?weakref\.CallableProxyType\.__getattr__ # Should have all attributes of proxy diff --git a/stdlib/@tests/stubtest_allowlists/py310.txt b/stdlib/@tests/stubtest_allowlists/py310.txt index 8abfb44283d7..b9117eba1d2e 100644 --- a/stdlib/@tests/stubtest_allowlists/py310.txt +++ b/stdlib/@tests/stubtest_allowlists/py310.txt @@ -108,6 +108,7 @@ _?bz2.BZ2Decompressor.__init__ # function does not accept parameters but C sign configparser.ParsingError.filename enum.Enum._generate_next_value_ importlib.abc.Finder.find_module +urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to super, so super args are specified xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub diff --git a/stdlib/@tests/stubtest_allowlists/py311.txt b/stdlib/@tests/stubtest_allowlists/py311.txt index 466709cf1542..aa5ab8aaf936 100644 --- a/stdlib/@tests/stubtest_allowlists/py311.txt +++ b/stdlib/@tests/stubtest_allowlists/py311.txt @@ -75,6 +75,7 @@ _?bz2.BZ2Decompressor.__init__ # function does not accept parameters but C sign configparser.ParsingError.filename enum.Enum._generate_next_value_ importlib.abc.Finder.find_module +urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to super, so super args are specified xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub diff --git a/stdlib/@tests/stubtest_allowlists/py39.txt b/stdlib/@tests/stubtest_allowlists/py39.txt index bd28caded683..f35239fff80b 100644 --- a/stdlib/@tests/stubtest_allowlists/py39.txt +++ b/stdlib/@tests/stubtest_allowlists/py39.txt @@ -75,6 +75,7 @@ _?bz2.BZ2Decompressor.__init__ # function does not accept parameters but C sign configparser.ParsingError.filename enum.Enum._generate_next_value_ importlib.abc.Finder.find_module +urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to super, so super args are specified xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub diff --git a/stdlib/_socket.pyi b/stdlib/_socket.pyi index 4cf71cbcadfa..9be0c3f2e669 100644 --- a/stdlib/_socket.pyi +++ b/stdlib/_socket.pyi @@ -78,7 +78,7 @@ if sys.platform == "win32": SO_EXCLUSIVEADDRUSE: int if sys.platform != "win32": SO_REUSEPORT: int - if sys.platform != "darwin" or sys.version_info >= (3, 13): + if sys.platform != "darwin": SO_BINDTODEVICE: int if sys.platform != "win32" and sys.platform != "darwin": diff --git a/stdlib/bdb.pyi b/stdlib/bdb.pyi index 75bfa91cc379..7e876af2ec32 100644 --- a/stdlib/bdb.pyi +++ b/stdlib/bdb.pyi @@ -1,6 +1,7 @@ import sys from _typeshed import ExcInfo, TraceFunction, Unused -from collections.abc import Callable, Iterable, Mapping +from collections.abc import Callable, Iterable, Iterator, Mapping +from contextlib import contextmanager from types import CodeType, FrameType, TracebackType from typing import IO, Any, Final, SupportsInt, TypeVar from typing_extensions import ParamSpec @@ -30,6 +31,10 @@ class Bdb: def __init__(self, skip: Iterable[str] | None = None) -> None: ... def canonic(self, filename: str) -> str: ... def reset(self) -> None: ... + if sys.version_info >= (3, 12): + @contextmanager + def set_enterframe(self, frame: FrameType) -> Iterator[None]: ... + def trace_dispatch(self, frame: FrameType, event: str, arg: Any) -> TraceFunction: ... def dispatch_line(self, frame: FrameType) -> TraceFunction: ... def dispatch_call(self, frame: FrameType, arg: None) -> TraceFunction: ... diff --git a/stdlib/email/_header_value_parser.pyi b/stdlib/email/_header_value_parser.pyi index ff405a8b61d2..a4c2d8b1a92e 100644 --- a/stdlib/email/_header_value_parser.pyi +++ b/stdlib/email/_header_value_parser.pyi @@ -1,3 +1,4 @@ +import sys from collections.abc import Iterable, Iterator from email.errors import HeaderParseError, MessageDefect from email.policy import Policy @@ -21,6 +22,9 @@ 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): + def make_quoted_pairs(value: Any) -> str: ... + def quote_string(value: Any) -> str: ... rfc2047_matcher: Pattern[str] diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index 3b6c325522d7..4a6287a712af 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -64,7 +64,11 @@ if sys.version_info >= (3, 11): def __init__(self, value: _EnumMemberT) -> None: ... class _EnumDict(dict[str, Any]): - def __init__(self) -> None: ... + if sys.version_info >= (3, 13): + def __init__(self, cls_name: str | None = None) -> None: ... + else: + def __init__(self) -> None: ... + def __setitem__(self, key: str, value: Any) -> None: ... if sys.version_info >= (3, 11): # See comment above `typing.MutableMapping.update` diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 64691b514a48..4a7c03632a67 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -240,6 +240,7 @@ if sys.platform == "linux" and sys.version_info >= (3, 12): "CLONE_VM", "setns", "unshare", + "PIDFD_NONBLOCK", ] if sys.platform == "linux" and sys.version_info >= (3, 10): __all__ += [ @@ -1603,6 +1604,9 @@ if sys.version_info >= (3, 9): if sys.platform == "linux": def pidfd_open(pid: int, flags: int = ...) -> int: ... +if sys.version_info >= (3, 12) and sys.platform == "linux": + PIDFD_NONBLOCK: Final = 2048 + if sys.version_info >= (3, 12) and sys.platform == "win32": def listdrives() -> list[str]: ... def listmounts(volume: str) -> list[str]: ... diff --git a/stdlib/posix.pyi b/stdlib/posix.pyi index 7a4d6cb4bdbe..e7223842ace5 100644 --- a/stdlib/posix.pyi +++ b/stdlib/posix.pyi @@ -379,6 +379,7 @@ if sys.platform != "win32": CLONE_SYSVSEM as CLONE_SYSVSEM, CLONE_THREAD as CLONE_THREAD, CLONE_VM as CLONE_VM, + PIDFD_NONBLOCK as PIDFD_NONBLOCK, setns as setns, unshare as unshare, ) diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index f982c9b893d8..1c996ac32278 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -515,7 +515,7 @@ if sys.platform != "win32": "IPV6_RTHDRDSTOPTS", ] - if sys.platform != "darwin" or sys.version_info >= (3, 13): + if sys.platform != "darwin": from _socket import SO_BINDTODEVICE as SO_BINDTODEVICE __all__ += ["SO_BINDTODEVICE"] diff --git a/stdlib/tokenize.pyi b/stdlib/tokenize.pyi index 2655f2f0266a..a1c4b412da83 100644 --- a/stdlib/tokenize.pyi +++ b/stdlib/tokenize.pyi @@ -125,6 +125,9 @@ class Untokenizer: prev_col: int encoding: str | None def add_whitespace(self, start: _Position) -> None: ... + if sys.version_info >= (3, 13): + def add_backslash_continuation(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, 12):