Skip to content

Commit b4455ff

Browse files
authored
Merge branch 'master' into fix_strict_quality_in_loops
2 parents 189f8b3 + 9c3ed87 commit b4455ff

141 files changed

Lines changed: 1498 additions & 597 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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,18 @@ jobs:
9595
# tox_extra_args: "-n 4 mypyc/test/test_run.py mypyc/test/test_external.py"
9696
# debug_build: true
9797

98+
- name: Parallel tests with py314-ubuntu, interpreted
99+
python: '3.14'
100+
os: ubuntu-24.04-arm
101+
toxenv: py
102+
tox_extra_args: "-n 4 --mypy-num-workers=4 mypy/test/testcheck.py"
103+
- name: Parallel tests with py314-ubuntu, mypyc-compiled
104+
python: '3.14'
105+
os: ubuntu-24.04-arm
106+
toxenv: py
107+
tox_extra_args: "-n 4 --mypy-num-workers=4 mypy/test/testcheck.py"
108+
test_mypyc: true
109+
98110
- name: Type check our own code (py310-ubuntu)
99111
python: '3.10'
100112
os: ubuntu-latest

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:

mypy/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@
4646
from __future__ import annotations
4747

4848
import sys
49+
from collections.abc import Callable
4950
from io import StringIO
50-
from typing import Callable, TextIO
51+
from typing import TextIO
5152

5253

5354
def _run(main_wrapper: Callable[[TextIO, TextIO], None]) -> tuple[str, str, int]:

mypy/applytype.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

3-
from collections.abc import Iterable, Sequence
4-
from typing import Callable
3+
from collections.abc import Callable, Iterable, Sequence
54

65
import mypy.subtypes
76
from mypy.erasetype import erase_typevars

mypy/argmap.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from __future__ import annotations
44

5-
from collections.abc import Sequence
6-
from typing import TYPE_CHECKING, Callable
5+
from collections.abc import Callable, Sequence
6+
from typing import TYPE_CHECKING
77

88
from mypy import nodes
99
from mypy.maptype import map_instance_to_supertype
@@ -36,8 +36,8 @@ def map_actuals_to_formals(
3636
The result contains a list of caller argument indexes mapping to each
3737
callee argument index, indexed by callee index.
3838
39-
The caller_arg_type argument should evaluate to the type of the actual
40-
argument type with the given index.
39+
The actual_arg_type argument should evaluate to the type of the actual
40+
argument with the given index.
4141
"""
4242
nformals = len(formal_kinds)
4343
formal_to_actual: list[list[int]] = [[] for i in range(nformals)]

mypy/binder.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
from collections import defaultdict
44
from collections.abc import Iterator
55
from contextlib import contextmanager
6-
from typing import NamedTuple
7-
from typing_extensions import TypeAlias as _TypeAlias
6+
from typing import NamedTuple, TypeAlias as _TypeAlias
87

98
from mypy.erasetype import remove_instance_last_known_values
109
from mypy.literals import Key, extract_var_from_literal_hash, literal, literal_hash, subkeys

0 commit comments

Comments
 (0)