Fix stdlib stubtest for latest Python patch releases (#13464)

This commit is contained in:
Alex Waygood
2025-02-05 23:33:27 +00:00
committed by GitHub
parent aac4394eb2
commit 5caaf2e1fb
12 changed files with 28 additions and 5 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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":

View File

@@ -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: ...

View File

@@ -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]

View File

@@ -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`

View File

@@ -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]: ...

View File

@@ -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,
)

View File

@@ -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"]

View File

@@ -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):