Skip to content

Commit d67036c

Browse files
authored
Merge branch 'main' into patch-1
2 parents 84a1c13 + ee21208 commit d67036c

609 files changed

Lines changed: 3245 additions & 135 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ repos:
2727
- "--unsafe-fixes"
2828
files: '.*test_cases/.+\.py$'
2929
- repo: https://github.com/psf/black-pre-commit-mirror
30-
rev: 26.3.1
30+
rev: 26.5.0
3131
hooks:
3232
- id: black
3333
- repo: https://github.com/pycqa/flake8

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ requires-python = ">=3.10" # Minimum version to run tests, used by uv run
99
line-length = 130
1010
target-version = ["py310"]
1111
skip-magic-trailing-comma = true
12+
preview = true
1213

1314
[tool.ruff]
1415
line-length = 130

stdlib/@tests/stubtest_allowlists/linux-py315.txt

Lines changed: 4 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,11 @@
1-
# ============================================
2-
# TODO: Allowlist entries that should be fixed
3-
# ============================================
1+
# =============================================================
2+
# Allowlist entries that cannot or should not be fixed; >= 3.15
3+
# =============================================================
44

55
# GitHub Actions' Python 3.15 Linux build currently lacks _decimal, so
66
# decimal falls back to _pydecimal with different runtime signatures.
7-
decimal\..*
87
_decimal
9-
os.AT_NO_AUTOMOUNT
10-
os.AT_STATX_DONT_SYNC
11-
os.AT_STATX_FORCE_SYNC
12-
os.AT_STATX_SYNC_AS_STAT
13-
os.STATX_ATIME
14-
os.STATX_BASIC_STATS
15-
os.STATX_BLOCKS
16-
os.STATX_BTIME
17-
os.STATX_CTIME
18-
os.STATX_DIOALIGN
19-
os.STATX_GID
20-
os.STATX_INO
21-
os.STATX_MNT_ID
22-
os.STATX_MNT_ID_UNIQUE
23-
os.STATX_MODE
24-
os.STATX_MTIME
25-
os.STATX_NLINK
26-
os.STATX_SIZE
27-
os.STATX_TYPE
28-
os.STATX_UID
29-
os.__all__
30-
os._clearenv
31-
os.statx
32-
os.statx_result
33-
posix.AT_NO_AUTOMOUNT
34-
posix.AT_STATX_DONT_SYNC
35-
posix.AT_STATX_FORCE_SYNC
36-
posix.AT_STATX_SYNC_AS_STAT
37-
posix.STATX_ATIME
38-
posix.STATX_BASIC_STATS
39-
posix.STATX_BLOCKS
40-
posix.STATX_BTIME
41-
posix.STATX_CTIME
42-
posix.STATX_DIOALIGN
43-
posix.STATX_GID
44-
posix.STATX_INO
45-
posix.STATX_MNT_ID
46-
posix.STATX_MNT_ID_UNIQUE
47-
posix.STATX_MODE
48-
posix.STATX_MTIME
49-
posix.STATX_NLINK
50-
posix.STATX_SIZE
51-
posix.STATX_TYPE
52-
posix.STATX_UID
53-
posix.statx
54-
55-
56-
# =============================================================
57-
# Allowlist entries that cannot or should not be fixed; >= 3.15
58-
# =============================================================
8+
decimal\..*
599

6010
# Depends on how readline was built.
6111
readline.get_pre_input_hook

stdlib/@tests/stubtest_allowlists/py315.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ _struct.pack_into
1818
_thread.RLock.__exit__
1919
_thread.lock.__exit__
2020
copy.deepcopy
21-
dataclasses._MISSING_TYPE
2221
dataclasses.MISSING
22+
dataclasses._MISSING_TYPE
2323
dataclasses.field
2424
doctest.DocTestRunner.report_skip
25-
enum.__all__
2625
importlib._abc.Loader.load_module
2726
importlib._bootstrap_external.NamespacePath
2827
importlib.abc.InspectLoader.source_to_code
@@ -37,9 +36,6 @@ threading.Condition.locked
3736
tkinter.Image.__iter__
3837
tkinter.Misc.__iter__
3938
tkinter.font.Font.__iter__
40-
tkinter.simpledialog.__all__
41-
typing_extensions.__all__
42-
xml.etree.ElementTree.__all__
4339

4440
# =============================================================
4541
# Allowlist entries that cannot or should not be fixed; >= 3.15
@@ -50,6 +46,9 @@ base64.b64decode
5046
urllib.parse.urlunparse
5147
urllib.parse.urlunsplit
5248

49+
# Runtime __all__ includes no_type_check_decorator, but the attribute does not exist on Python 3.15.
50+
typing_extensions.__all__
51+
5352
# Internal implementation details of the sampling profiler.
5453
profiling.sampling.binary_collector
5554
profiling.sampling.binary_reader

stdlib/@tests/stubtest_allowlists/win32-py315.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
# ============================================
2-
# TODO: Allowlist entries that should be fixed
3-
# ============================================
4-
5-
_winapi.DeregisterEventSource
6-
_winapi.EVENTLOG_AUDIT_FAILURE
7-
_winapi.EVENTLOG_AUDIT_SUCCESS
8-
_winapi.EVENTLOG_ERROR_TYPE
9-
_winapi.EVENTLOG_INFORMATION_TYPE
10-
_winapi.EVENTLOG_SUCCESS
11-
_winapi.EVENTLOG_WARNING_TYPE
12-
_winapi.GetOEMCP
13-
_winapi.RegisterEventSource
14-
_winapi.ReportEvent
15-
winreg.DeleteTree
16-
17-
181
# =============================================================
192
# Allowlist entries that cannot or should not be fixed; >= 3.15
203
# =============================================================

stdlib/_asyncio.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ class Future(Awaitable[_T]):
1616
@property
1717
def _exception(self) -> BaseException | None: ...
1818
_blocking: bool
19+
1920
@property
2021
def _log_traceback(self) -> bool: ...
2122
@_log_traceback.setter
2223
def _log_traceback(self, val: Literal[False]) -> None: ...
24+
2325
_asyncio_future_blocking: bool # is a part of duck-typing contract for `Future`
2426
def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ...
2527
def __del__(self) -> None: ...

stdlib/_bisect.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def bisect_left(
3838
def bisect_left(
3939
a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: Callable[[_T], SupportsRichComparisonT]
4040
) -> int: ...
41+
4142
@overload
4243
def bisect_right(
4344
a: SupportsLenAndGetItem[SupportsRichComparisonT],
@@ -72,6 +73,7 @@ def bisect_right(
7273
def bisect_right(
7374
a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: Callable[[_T], SupportsRichComparisonT]
7475
) -> int: ...
76+
7577
@overload
7678
def insort_left(
7779
a: MutableSequence[SupportsRichComparisonT],
@@ -85,6 +87,7 @@ def insort_left(
8587
def insort_left(
8688
a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT]
8789
) -> None: ...
90+
8891
@overload
8992
def insort_right(
9093
a: MutableSequence[SupportsRichComparisonT],

stdlib/_codecs.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "
4949
def encode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ... # type: ignore[overload-overlap]
5050
@overload
5151
def encode(obj: str, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
52+
5253
@overload
5354
def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ... # type: ignore[overload-overlap]
5455
@overload
@@ -67,6 +68,7 @@ def decode(
6768
def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = "strict") -> bytes: ...
6869
@overload
6970
def decode(obj: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> str: ...
71+
7072
def lookup(encoding: str, /) -> codecs.CodecInfo: ...
7173
def charmap_build(map: str, /) -> _CharMap: ...
7274
def ascii_decode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ...

stdlib/_contextvars.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ class ContextVar(Generic[_T]):
1414
def __new__(cls, name: str) -> Self: ...
1515
@overload
1616
def __new__(cls, name: str, *, default: _T) -> Self: ...
17+
1718
def __hash__(self) -> int: ...
1819
@property
1920
def name(self) -> str: ...
21+
2022
@overload
2123
def get(self) -> _T: ...
2224
@overload
2325
def get(self, default: _T, /) -> _T: ...
2426
@overload
2527
def get(self, default: _D, /) -> _D | _T: ...
28+
2629
def set(self, value: _T, /) -> Token[_T]: ...
2730
def reset(self, token: Token[_T], /) -> None: ...
2831
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
@@ -49,12 +52,14 @@ def copy_context() -> Context: ...
4952
@final
5053
class Context(Mapping[ContextVar[Any], Any]):
5154
def __init__(self) -> None: ...
55+
5256
@overload
5357
def get(self, key: ContextVar[_T], default: None = None, /) -> _T | None: ...
5458
@overload
5559
def get(self, key: ContextVar[_T], default: _T, /) -> _T: ...
5660
@overload
5761
def get(self, key: ContextVar[_T], default: _D, /) -> _T | _D: ...
62+
5863
def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ...
5964
def copy(self) -> Context: ...
6065
__hash__: ClassVar[None] # type: ignore[assignment]

stdlib/_ctypes.pyi

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,25 @@ class _PyCPointerType(_CTypeBaseType):
127127
class _Pointer(_PointerLike, _CData, Generic[_CT], metaclass=_PyCPointerType):
128128
_type_: type[_CT]
129129
contents: _CT
130+
130131
@overload
131132
def __init__(self) -> None: ...
132133
@overload
133134
def __init__(self, arg: _CT) -> None: ...
135+
134136
@overload
135137
def __getitem__(self, key: int, /) -> Any: ...
136138
@overload
137139
def __getitem__(self, key: slice[SupportsIndex | None], /) -> list[Any]: ...
140+
138141
def __setitem__(self, key: int, value: Any, /) -> None: ...
139142

140143
if sys.version_info < (3, 14):
141144
@overload
142145
def POINTER(type: None, /) -> type[c_void_p]: ...
143146
@overload
144147
def POINTER(type: type[_CT], /) -> type[_Pointer[_CT]]: ...
148+
145149
def pointer(obj: _CT, /) -> _Pointer[_CT]: ...
146150

147151
# This class is not exposed. It calls itself _ctypes.CArgObject.
@@ -177,6 +181,7 @@ class CFuncPtr(_PointerLike, _CData, metaclass=_PyCFuncPtrType):
177181
errcheck: _ECT
178182
# Abstract attribute that must be defined on subclasses
179183
_flags_: ClassVar[int]
184+
180185
@overload
181186
def __new__(cls) -> Self: ...
182187
@overload
@@ -209,10 +214,12 @@ if sys.version_info >= (3, 14):
209214
bit_offset: int
210215
bit_size: int
211216
is_anonymous: bool
217+
212218
@overload
213219
def __get__(self, instance: None, owner: builtins.type[Any] | None = None, /) -> Self: ...
214220
@overload
215221
def __get__(self, instance: Any, owner: builtins.type[Any] | None = None, /) -> _GetT: ...
222+
216223
def __set__(self, instance: Any, value: _SetT, /) -> None: ...
217224

218225
_CField = CField
@@ -223,10 +230,12 @@ else:
223230
class _CField(Generic[_CT, _GetT, _SetT]):
224231
offset: int
225232
size: int
233+
226234
@overload
227235
def __get__(self, instance: None, owner: type[Any] | None = None, /) -> Self: ...
228236
@overload
229237
def __get__(self, instance: Any, owner: type[Any] | None = None, /) -> _GetT: ...
238+
230239
def __set__(self, instance: Any, value: _SetT, /) -> None: ...
231240

232241
# This class is not exposed. It calls itself _ctypes.UnionType.
@@ -308,16 +317,19 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
308317
def _length_(self) -> int: ...
309318
@_length_.setter
310319
def _length_(self, value: int) -> None: ...
320+
311321
@property
312322
@abstractmethod
313323
def _type_(self) -> type[_CT]: ...
314324
@_type_.setter
315325
def _type_(self, value: type[_CT]) -> None: ...
326+
316327
# Note: only available if _CT == c_char
317328
@property
318329
def raw(self) -> bytes: ...
319330
@raw.setter
320331
def raw(self, value: ReadableBuffer) -> None: ...
332+
321333
value: Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise
322334
# TODO: These methods cannot be annotated correctly at the moment.
323335
# All of these "Any"s stand for the array's element type, but it's not possible to use _CT
@@ -332,14 +344,17 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
332344
# This special behavior is not easy to model in a stub, so for now all places where
333345
# the array element type would belong are annotated with Any instead.
334346
def __init__(self, *args: Any) -> None: ...
347+
335348
@overload
336349
def __getitem__(self, key: int, /) -> Any: ...
337350
@overload
338351
def __getitem__(self, key: slice[SupportsIndex | None], /) -> list[Any]: ...
352+
339353
@overload
340354
def __setitem__(self, key: int, value: Any, /) -> None: ...
341355
@overload
342356
def __setitem__(self, key: slice[SupportsIndex | None], value: Iterable[Any], /) -> None: ...
357+
343358
def __iter__(self) -> Iterator[Any]: ...
344359
# Can't inherit from Sized because the metaclass conflict between
345360
# Sized and _CData prevents using _CDataMeta.

0 commit comments

Comments
 (0)