Skip to content

Difference in results between parallel run and not #21644

Description

@DanZee

Bug Report
Mypy 2.1 on windows returns a different set of errors with and without the "-n" option.

To Reproduce
Config file:

[tool.mypy]
enable_error_code = [ "ignore-without-code" ]

Python code:

from __future__ import annotations

from typing import Any, Generic, TypeVarTuple

Ts = TypeVarTuple("Ts")
X = Any


class G(Generic[*Ts]):
    _m: dict[tuple[*Ts], int]

    def f(self) -> tuple[type[X], ...]:
        if not self._m:
            return ()

        i = iter(self._m)
        a = tuple(map(type, next(i)))
        for b in i:
            a = tuple(
                c | type(d)  # type: ignore[var-annotated, misc]
                for c, d in zip(a, b)  # type: ignore[arg-type]
            )

        return a

Expected Behavior

Consistent results regardless of using -n or not.

Actual Behavior

mypy --config-file mypyconfig.toml  repro.py
repro.py:19: error: Need type annotation for "d"  [var-annotated]
Found 1 error in 1 file (checked 1 source file)
mypy -n8 --config-file mypyconfig.toml repro.py
Success: no issues found in 1 source file

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions