Skip to content

Commit 877e000

Browse files
authored
Merge branch 'master' into closed.keyword
2 parents 4d3a7b0 + 5e0c274 commit 877e000

167 files changed

Lines changed: 4928 additions & 1308 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.

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
with:
4545
python-version: '3.12'
4646
- name: Install tox
47-
run: pip install tox==4.26.0
47+
run: pip install tox==4.53.1
4848
- name: Setup tox environment
4949
run: tox run -e ${{ env.TOXENV }} --notest
5050
- name: Test

.github/workflows/test.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ jobs:
5959
toxenv: py
6060
tox_extra_args: "-n 4"
6161
test_mypyc: true
62+
- name: Test suite with py315-ubuntu, mypyc-compiled
63+
python: '3.15'
64+
os: ubuntu-24.04-arm
65+
toxenv: py
66+
tox_extra_args: "-n 4"
67+
test_mypyc: true
6268
- name: Test suite with py314t-ubuntu, mypyc-compiled
6369
python: '3.14t'
6470
os: ubuntu-24.04-arm
@@ -196,6 +202,7 @@ jobs:
196202
if: ${{ !(matrix.debug_build || endsWith(matrix.python, '-dev')) }}
197203
with:
198204
python-version: ${{ matrix.python }}
205+
allow-prereleases: true
199206

200207
- name: Install tox
201208
run: |
@@ -206,7 +213,7 @@ jobs:
206213
echo debug build; python -c 'import sysconfig; print(bool(sysconfig.get_config_var("Py_DEBUG")))'
207214
echo os.cpu_count; python -c 'import os; print(os.cpu_count())'
208215
echo os.sched_getaffinity; python -c 'import os; print(len(getattr(os, "sched_getaffinity", lambda *args: [])(0)))'
209-
pip install tox==4.26.0
216+
pip install tox==4.53.1
210217
211218
- name: Compiled with mypyc
212219
if: ${{ matrix.test_mypyc }}
@@ -271,7 +278,7 @@ jobs:
271278
default: 3.11.1
272279
command: python -c "import platform; print(f'{platform.architecture()=} {platform.machine()=}');"
273280
- name: Install tox
274-
run: pip install tox==4.26.0
281+
run: pip install tox==4.53.1
275282
- name: Setup tox environment
276283
run: tox run -e py --notest
277284
- name: Test

CHANGELOG.md

Lines changed: 298 additions & 9 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,18 @@ tox -e dev --override testenv:dev.allowlist_externals+=env -- env # inspect the
123123
If you don't already have `tox` installed, you can use a virtual environment as
124124
described above to install `tox` via `pip` (e.g., ``python -m pip install tox``).
125125

126+
## LLM-assisted contributions
127+
128+
In general, mypy takes a neutral stance on using various LLM code assistants to
129+
make contributions. LLMs are just another tool, and contributors bear full
130+
responsibility for the code they are submitting. Disclosing the use of LLMs in
131+
pull request description is recommended, but not required.
132+
133+
However, we discourage use of LLMs by *new* contributors. We are interested in
134+
growing long-term contributors who have good understanding of mypy code.
135+
Pull requests from new contributors that are mostly generated by LLMs
136+
with little human input will be closed.
137+
126138
## First time contributors
127139

128140
If you're looking for things to help with, browse our [issue tracker](https://github.com/python/mypy/issues)!

docs/source/command_line.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,9 @@ enabled by default starting from mypy 2.0.
10521052
disables parallel checking. Automatic detection of the optimal number
10531053
of workers is not supported yet.
10541054

1055+
This setting will override the ``MYPY_NUM_WORKERS`` environment
1056+
variable if it is set.
1057+
10551058
Notes:
10561059

10571060
* An import cycle is always processed as a whole by a worker process. Thus,

docs/source/config_file.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,8 @@ These options may only be set in the global section (``[mypy]``).
10181018

10191019
Use specific number of parallel worker processes for type-checking, see
10201020
:ref:`parallel type-checking <parallel>` for more details.
1021+
This setting will be overridden by the ``MYPY_NUM_WORKERS`` environment
1022+
variable.
10211023

10221024

10231025
Advanced options

docs/source/error_code_list2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ Example:
550550
Check that overrides of mutable attributes are safe [mutable-override]
551551
----------------------------------------------------------------------
552552

553-
`mutable-override` will enable the check for unsafe overrides of mutable attributes.
553+
``mutable-override`` will enable the check for unsafe overrides of mutable attributes.
554554
For historical reasons, and because this is a relatively common pattern in Python,
555555
this check is not enabled by default. The example below is unsafe, and will be
556556
flagged when this error code is enabled:

docs/source/more_types.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ implementation, then the body is not type checked. If you want to
573573
force mypy to check the body anyways, use the :option:`--check-untyped-defs <mypy --check-untyped-defs>`
574574
flag (:ref:`more details here <untyped-definitions-and-calls>`).
575575

576-
The variants must also also be compatible with the implementation
576+
The variants must also be compatible with the implementation
577577
type hints. In the ``MyList`` example, mypy will check that the
578578
parameter type ``int`` and the return type ``T`` are compatible with
579579
``int | slice`` and ``T | Sequence`` for the
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
From 7f38b86464d59188a87ff8c9913c257e788a2f0b Mon Sep 17 00:00:00 2001
2+
From: hauntsaninja <hauntsaninja@gmail.com>
3+
Date: Wed, 6 May 2026 19:49:41 -0700
4+
Subject: [PATCH] Revert operator changes
5+
6+
---
7+
mypy/typeshed/stdlib/_operator.pyi | 51 ++++++++----------------------
8+
1 file changed, 14 insertions(+), 37 deletions(-)
9+
10+
diff --git a/mypy/typeshed/stdlib/_operator.pyi b/mypy/typeshed/stdlib/_operator.pyi
11+
index e7d85f811..8c705065b 100644
12+
--- a/mypy/typeshed/stdlib/_operator.pyi
13+
+++ b/mypy/typeshed/stdlib/_operator.pyi
14+
@@ -1,15 +1,5 @@
15+
import sys
16+
-from _typeshed import (
17+
- SupportsAdd,
18+
- SupportsGetItem,
19+
- SupportsMod,
20+
- SupportsMul,
21+
- SupportsRAdd,
22+
- SupportsRMod,
23+
- SupportsRMul,
24+
- SupportsRSub,
25+
- SupportsSub,
26+
-)
27+
+from _typeshed import SupportsGetItem
28+
from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence
29+
from operator import attrgetter as attrgetter, itemgetter as itemgetter, methodcaller as methodcaller
30+
from typing import Any, AnyStr, Protocol, SupportsAbs, SupportsIndex, TypeVar, overload, type_check_only
31+
@@ -18,7 +8,6 @@ from typing_extensions import ParamSpec, TypeAlias, TypeIs
32+
_R = TypeVar("_R")
33+
_T = TypeVar("_T")
34+
_T_co = TypeVar("_T_co", covariant=True)
35+
-_T_contra = TypeVar("_T_contra", contravariant=True)
36+
_K = TypeVar("_K")
37+
_V = TypeVar("_V")
38+
_P = ParamSpec("_P")
39+
@@ -69,36 +58,24 @@ def truth(a: object, /) -> bool: ...
40+
def is_(a: object, b: object, /) -> bool: ...
41+
def is_not(a: object, b: object, /) -> bool: ...
42+
def abs(a: SupportsAbs[_T], /) -> _T: ...
43+
-@overload
44+
-def add(a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
45+
-@overload
46+
-def add(a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co: ...
47+
-def and_(a, b, /): ...
48+
-def floordiv(a, b, /): ...
49+
+def add(a: Any, b: Any, /) -> Any: ...
50+
+def and_(a: Any, b: Any, /) -> Any: ...
51+
+def floordiv(a: Any, b: Any, /) -> Any: ...
52+
def index(a: SupportsIndex, /) -> int: ...
53+
def inv(a: _SupportsInversion[_T_co], /) -> _T_co: ...
54+
def invert(a: _SupportsInversion[_T_co], /) -> _T_co: ...
55+
-def lshift(a, b, /): ...
56+
-@overload
57+
-def mod(a: SupportsMod[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
58+
-@overload
59+
-def mod(a: _T_contra, b: SupportsRMod[_T_contra, _T_co], /) -> _T_co: ...
60+
-@overload
61+
-def mul(a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
62+
-@overload
63+
-def mul(a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co: ...
64+
-def matmul(a, b, /): ...
65+
+def lshift(a: Any, b: Any, /) -> Any: ...
66+
+def mod(a: Any, b: Any, /) -> Any: ...
67+
+def mul(a: Any, b: Any, /) -> Any: ...
68+
+def matmul(a: Any, b: Any, /) -> Any: ...
69+
def neg(a: _SupportsNeg[_T_co], /) -> _T_co: ...
70+
-def or_(a, b, /): ...
71+
+def or_(a: Any, b: Any, /) -> Any: ...
72+
def pos(a: _SupportsPos[_T_co], /) -> _T_co: ...
73+
-def pow(a, b, /): ...
74+
-def rshift(a, b, /): ...
75+
-@overload
76+
-def sub(a: SupportsSub[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
77+
-@overload
78+
-def sub(a: _T_contra, b: SupportsRSub[_T_contra, _T_co], /) -> _T_co: ...
79+
-def truediv(a, b, /): ...
80+
-def xor(a, b, /): ...
81+
+def pow(a: Any, b: Any, /) -> Any: ...
82+
+def rshift(a: Any, b: Any, /) -> Any: ...
83+
+def sub(a: Any, b: Any, /) -> Any: ...
84+
+def truediv(a: Any, b: Any, /) -> Any: ...
85+
+def xor(a: Any, b: Any, /) -> Any: ...
86+
def concat(a: Sequence[_T], b: Sequence[_T], /) -> Sequence[_T]: ...
87+
def contains(a: Container[object], b: object, /) -> bool: ...
88+
def countOf(a: Iterable[object], b: object, /) -> int: ...
89+
--
90+
2.53.0
91+

mypy-requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ typing_extensions>=4.14.0; python_version>='3.15'
55
mypy_extensions>=1.0.0
66
pathspec>=1.0.0
77
tomli>=1.1.0; python_version<'3.11'
8-
librt>=0.9.0; platform_python_implementation != 'PyPy'
9-
ast-serialize>=0.3.0,<1.0.0
8+
librt>=0.11.0; platform_python_implementation != 'PyPy'
9+
ast-serialize>=0.5.0,<1.0.0

0 commit comments

Comments
 (0)