Do not display import-related errors after module-level always false assert#19347
Conversation
This comment has been minimized.
This comment has been minimized.
|
One reason I'm surprised about this is that my impression was that after a module-level assert that is unreachable, mypy removes all nodes. Am I misremembering? Or is this an earlier pass? |
|
@A5rocks Great question. Imports are collected during parsing, and "definitely unreachable" truncation step follows ( |
This comment has been minimized.
This comment has been minimized.
A5rocks
left a comment
There was a problem hiding this comment.
This makes sense to me!
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@petamasS3D just wait - I usually follow up on my PRs monthly if they lack attention. Things just aren't quickly merged here except for trivial fixes/emergencies, and this one certainly isn't a trivial fix (and is a bit hacky), so it's normal to wait a while and gather feedback from other maintainers. If this issue is blocking you, you can safely add an ignore comment - typechecker false positive is one of perfectly legitimate reasons to use them. |
|
@sterliakov: thanks for the insight! I saw that there are a LOT of newer PRs already merged, and was afraid this one somehow got lost. It's not blocking me at the moment (I've worked around the issue using an |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Diff from mypy_primer, showing the effect of this PR on open source code: PyWinCtl (https://github.com/Kalmat/PyWinCtl)
- src/pywinctl/_pywinctl_win.py:28: error: Cannot find implementation or library stub for module named "pywinbox" [import-not-found]
- src/pywinctl/_pywinctl_macos.py:25: error: Cannot find implementation or library stub for module named "pywinbox" [import-not-found]
|
|
@JukkaL can we try to get this into the next release? The change is trivial and there's no sane workaround for the problem |
Fixes #19346