Skip to content

Commit 34ad2f8

Browse files
committed
Merge remote-tracking branch 'upstream/master' into invalidvarcall
2 parents 68ee559 + 5bba0c3 commit 34ad2f8

253 files changed

Lines changed: 4360 additions & 2613 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/mypy_primer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
persist-credentials: false
4040
- uses: actions/setup-python@v5
4141
with:
42-
python-version: "3.13"
42+
python-version: "3.14"
4343
- name: Install dependencies
4444
run: |
4545
python -m pip install -U pip

.github/workflows/test.yml

Lines changed: 18 additions & 0 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 py314t-ubuntu, mypyc-compiled
63+
python: '3.14t'
64+
os: ubuntu-24.04-arm
65+
toxenv: py
66+
tox_extra_args: "-n 4"
67+
test_mypyc: true
6268
- name: Test suite with py314-windows-64
6369
python: '3.14'
6470
os: windows-latest
@@ -95,6 +101,18 @@ jobs:
95101
# tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
96102
# debug_build: true
97103

104+
- name: Parallel tests with py314-ubuntu, interpreted
105+
python: '3.14'
106+
os: ubuntu-24.04-arm
107+
toxenv: py
108+
tox_extra_args: "-n 4 --mypy-num-workers=4 mypy/test/testcheck.py"
109+
- name: Parallel tests with py314-ubuntu, mypyc-compiled
110+
python: '3.14'
111+
os: ubuntu-24.04-arm
112+
toxenv: py
113+
tox_extra_args: "-n 4 --mypy-num-workers=4 mypy/test/testcheck.py"
114+
test_mypyc: true
115+
98116
- name: Type check our own code (py310-ubuntu)
99117
python: '3.10'
100118
os: ubuntu-latest

CHANGELOG.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ Support for this will be dropped in the first half of 2026!
1111

1212
Contributed by Marc Mueller (PR [20156](https://github.com/python/mypy/pull/20156)).
1313

14+
### Removed flags `--force-uppercase-builtins` and `--force-union-syntax`
15+
16+
The `--force-uppercase-builtins` flag was deprecated and has been a no-op since mypy 1.17.0.
17+
Since mypy has dropped support for Python 3.9, the `--force-union-syntax` flag is no longer
18+
necessary.
19+
20+
Contributed by Marc Mueller (PR [20410](https://github.com/python/mypy/pull/20410))
21+
and (PR [20405](https://github.com/python/mypy/pull/20405)).
22+
1423
## Mypy 1.19
1524

1625
We’ve just uploaded mypy 1.19.0 to the Python Package Index ([PyPI](https://pypi.org/project/mypy/)).
@@ -216,6 +225,17 @@ Related PRs:
216225

217226
Please see [git log](https://github.com/python/typeshed/commits/main?after=ebce8d766b41fbf4d83cf47c1297563a9508ff60+0&branch=main&path=stdlib) for full list of standard library typeshed stub changes.
218227

228+
### Mypy 1.19.1
229+
230+
- Fix noncommutative joins with bounded TypeVars (Shantanu, PR [20345](https://github.com/python/mypy/pull/20345))
231+
- Respect output format for cached runs by serializing raw errors in cache metas (Ivan Levkivskyi, PR [20372](https://github.com/python/mypy/pull/20372))
232+
- Allow `types.NoneType` in match cases (A5rocks, PR [20383](https://github.com/python/mypy/pull/20383))
233+
- Fix mypyc generator regression with empty tuple (BobTheBuidler, PR [20371](https://github.com/python/mypy/pull/20371))
234+
- Fix crash involving Unpack-ed TypeVarTuple (Shantanu, PR [20323](https://github.com/python/mypy/pull/20323))
235+
- Fix crash on star import of redefinition (Ivan Levkivskyi, PR [20333](https://github.com/python/mypy/pull/20333))
236+
- Fix crash on typevar with forward ref used in other module (Ivan Levkivskyi, PR [20334](https://github.com/python/mypy/pull/20334))
237+
- Fail with an explicit error on PyPy (Ivan Levkivskyi, PR [20389](https://github.com/python/mypy/pull/20389))
238+
219239
### Acknowledgements
220240

221241
Thanks to all mypy contributors who contributed to this release:
@@ -251,7 +271,7 @@ Thanks to all mypy contributors who contributed to this release:
251271

252272
I’d also like to thank my employer, Dropbox, for supporting mypy development.
253273

254-
## Mypy 1.18.1
274+
## Mypy 1.18
255275

256276
We’ve just uploaded mypy 1.18.1 to the Python Package Index ([PyPI](https://pypi.org/project/mypy/)).
257277
Mypy is a static type checker for Python. This release includes new features, performance

docs/source/additional_features.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Type annotations can be added as follows:
135135

136136
.. code-block:: python
137137
138-
import attr
138+
import attrs
139139
140140
@attrs.define
141141
class A:

docs/source/command_line.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -958,12 +958,6 @@ in error messages.
958958
useful or they may be overly noisy. If ``N`` is negative, there is
959959
no limit. The default limit is -1.
960960

961-
.. option:: --force-union-syntax
962-
963-
Always use ``Union[]`` and ``Optional[]`` for union types
964-
in error messages (instead of the ``|`` operator),
965-
even on Python 3.10+.
966-
967961

968962
.. _incremental:
969963

docs/source/config_file.rst

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

931931
Show absolute paths to files.
932932

933-
.. confval:: force_union_syntax
934-
935-
:type: boolean
936-
:default: False
937-
938-
Always use ``Union[]`` and ``Optional[]`` for union types
939-
in error messages (instead of the ``|`` operator),
940-
even on Python 3.10+.
941-
942933
Incremental mode
943934
****************
944935

docs/source/error_code_list.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,25 @@ Warn about cases where a bytes object may be converted to a string in an unexpec
11511151
print(f"The alphabet starts with {b!r}") # The alphabet starts with b'abc'
11521152
print(f"The alphabet starts with {b.decode('utf-8')}") # The alphabet starts with abc
11531153
1154+
.. _code-str-unpack:
1155+
1156+
Check that ``str`` is not unpacked [str-unpack]
1157+
---------------------------------------------------------
1158+
1159+
It can sometimes be surprising that ``str`` is iterable, especially when unpacking
1160+
in an assignment.
1161+
1162+
Example:
1163+
1164+
.. code-block:: python
1165+
1166+
def print_dict(d: dict[str, str]) -> int:
1167+
# We meant to do d.items(), but instead we're unpacking the str keys of d
1168+
1169+
# Error: Unpacking a string is disallowed
1170+
for k, v in d:
1171+
print(k, v)
1172+
11541173
.. _code-overload-overlap:
11551174

11561175
Check that overloaded functions don't overlap [overload-overlap]

misc/analyze_cache.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
import os.path
88
from collections import Counter
99
from collections.abc import Iterable
10-
from typing import Any, Final
11-
from typing_extensions import TypeAlias as _TypeAlias
10+
from typing import Any, Final, TypeAlias as _TypeAlias
1211

1312
ROOT: Final = ".mypy_cache/3.5"
1413

misc/incremental_checker.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
import textwrap
4545
import time
4646
from argparse import ArgumentParser, Namespace, RawDescriptionHelpFormatter
47-
from typing import Any, Final
48-
from typing_extensions import TypeAlias as _TypeAlias
47+
from typing import Any, Final, TypeAlias as _TypeAlias
4948

5049
CACHE_PATH: Final = ".incremental_checker_cache.json"
5150
MYPY_REPO_URL: Final = "https://github.com/python/mypy.git"

misc/perf_checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import subprocess
99
import textwrap
1010
import time
11-
from typing import Callable
11+
from collections.abc import Callable
1212

1313

1414
class Command:

0 commit comments

Comments
 (0)