Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dmypy] sort list of files for update by extension #17245

Merged
merged 1 commit into from
May 15, 2024

Conversation

svalentin
Copy link
Collaborator

@svalentin svalentin commented May 14, 2024

dmypy receives the list of updated files via --update flag. If this list contains both foo.py and foo.pyi, the order matters. It seems to process the first file in the list first. But if we have a .pyi file, we want this to be processed first since this one contains the typing information.
Let's reverse sort the list of updated files by the extension. This should be a simple enough fix to resolve this.

Though there might be some edge cases where the list of files to update contains just pyi files, but we might need to recheck the equivalent py files even if not explicitly updated.

dmypy receives the list of updated files via `--update` flag.
If this list contains both `foo.py` and `foo.pyi`, the order matters.
It seems to process the first file in the list first. But if we have a
`.pyi` file, we want this to be processed first since this one contains
the typing information.
Let's reverse sort the list of updated files by the extension. This
should be a simple enough fix to resolve this.
@svalentin svalentin requested a review from JukkaL May 14, 2024 22:05
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, I've experienced the issue several times.

@svalentin svalentin merged commit 0a2225b into python:master May 15, 2024
18 checks passed
@svalentin svalentin deleted the dmypy-bug branch May 15, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants