Skip to content

Results vary with the order of the specified files. #12592

@mrolle45

Description

@mrolle45

I have a project with many modules. A group of 30 of them are in a cyclic import SCC.

I ran mypy under Visual Studio. While trying to see why some errors appeared, I ran a copy of the mypy code with a debugger. I noticed that I got quite a different set of errors reported.
The difference was that Visual Studio passes filenames to mypy in the order that it finds them in the project, whereas I used "mypy ." for the debugging. mypy processed the same set of input files, but in a different order.

I made a names file with the names in the order used by VS, and then ran mypy using this names file, with same result as running under VS.

I've collected log files from both runs. They include a bunch of extra messages which I put into my code, so as to help me figure out what was going on. It includes details about imports and symbol definitions in this SCC, and two files, cache and solver.common in particular.

I have attached a zip with these logs. It also includes just the error messages extracted from the logs. You will see the greatly different results. 148 errors in one case and 93 errors in the other case.

It's apparent to me that the order of the files in this SCC is what makes the difference. I will be looking at what in detail is different and why that is happening. It has something to do with marking a module as incomplete when it imports * from another incomplete module, and some, but not all, of the needed symbols are imported only during the final iteration.

However, in the meantime, here are the output files, if you want to see what you can make of them. The order of the SCC is shown in line 873 of each log file.
Exp.zip

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