Skip to content

mypy and dmypy run are not agreeing #15214

@alanhdu

Description

@alanhdu

Bug Report

I'm not sure if I misunderstood the documentation, but I assumed that mypy and dmypy run would should always return the same thing when run on the same code. This does not seem to be the case though:

To Reproduce

If I have the simple file:

_var = None

def set_var():
    global _var
    if not _var:
        _var = 1
    return _var

then mypy foo.py gives success, while dmypy run -- foo.py reports:

Daemon started
mypy foo.py
foo.py:3: error: Need type annotation for "_var" (hint: "_var: Optional[<type>] = ...")  [var-annotated]
Found 1 error in 1 file (checked 44 source files)

This is on both mypy 1.2.0 (compiled: yes) and mypy 1.4.0+dev.35acb1bf69c990fcd89eeec32e35ae21f93c2d84 (compiled: no).

Expected Behavior

I would've expected either both of them to fail with the same error, or both of them to succeed. Alternatively, I would've expected the docs to spell out what the configuration differences are between mypy and dmypy

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions