Fix crash with report generation on namespace packages (again)#16019
Merged
hauntsaninja merged 1 commit intopython:masterfrom Sep 2, 2023
Merged
Fix crash with report generation on namespace packages (again)#16019hauntsaninja merged 1 commit intopython:masterfrom
hauntsaninja merged 1 commit intopython:masterfrom
Conversation
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: vision (https://github.com/pytorch/vision): typechecking got 1.38x slower (36.7s -> 50.6s)
(Performance measurements are based on a single noisy sample)
|
wyattscarpenter
added a commit
to wyattscarpenter/mypy
that referenced
this pull request
Oct 24, 2025
python#16019, which fixed this issue (for linux) was not accompanied by a regression test
ilevkivskyi
added a commit
that referenced
this pull request
Oct 27, 2025
#20111) #16019, which fixed this issue (for linux) was not accompanied by a regression test. Thus, nobody noticed that it doesn't work on Windows! This fixes an Internal Error where namespace packages were not supported properly. This fix was inspired by @sterliakov noticing that #18128 was very similar to #19843, which has a similar fix. Note that we use `os.path.isdir(tree.path)` instead of trying to catch an `IsADirectoryError` exception because of a bug on Windows which causes it to throw a `PermissionError` instead in [the relevant situation](https://discuss.python.org/t/permissionerror-errno-13-permission-denied-python-2023/22360/8), which makes `except IsADirectoryError` unreliable. (We also can't just `except (IsADirectoryError, PermissionError)` because what if there is an actual permission error?) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ivan Levkivskyi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15979. Fix is similar to that in
iterate_python_lines.