Skip to content

MyPy is nondeterministic across runs #16979

@wjakob

Description

@wjakob

Bug Report
I'm observing nondeterminism in MyPy runs on one of my programs. Sometimes, it accepts a file, sometimes it doesn't. Once it has accepted a file it seems to cache this solution, and I need to wipe .mypy_cache to be able to reproduce the random behavior again.

To Reproduce

Download and extract the following archive (repro.tar.gz), which contains stubs from a library I am developing along with a test.py file to be checked.

This is output from an actual run on my end:

$ mypy test.py
test.py:74: error: Incompatible types in assignment (expression has type "object", variable has type "Array3f")  [assignment]
Found 1 error in 1 file (checked 1 source file)

$ mypy test.py
Success: no issues found in 1 source file

Details on setup: mypy 1.8.0 (compiled: yes), Python 3.12.2, on an Apple M1 laptop (macOS 16.6.2). The machine is and has been perfectly stable. That is to say: I don't expect cosmic rays or RAM corruption to be responsible ;).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions