Skip to content

Conversation

@hauntsaninja
Copy link
Collaborator

Fixes #15979. Fix is similar to that in iterate_python_lines.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2023

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)

@hauntsaninja hauntsaninja merged commit 5adf934 into python:master Sep 2, 2023
@hauntsaninja hauntsaninja deleted the report-gen branch September 10, 2023 19:58
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]>
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.

While checking package: 'IsADirectoryError' on directories not containing any '.py'-files

1 participant