Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Do not display import-related errors after module-level always false assert#19347

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
sterliakov wants to merge7 commits intopython:master
base:master
Choose a base branch
Loading
fromsterliakov:bugfix/gh-19346-assert-import

Conversation

sterliakov
Copy link
Collaborator

Fixes#19346

@sterliakovsterliakov marked this pull request as ready for reviewJune 26, 2025 23:04
@sterliakovsterliakov marked this pull request as draftJune 26, 2025 23:33
@sterliakovsterliakov marked this pull request as ready for reviewJune 27, 2025 00:22
@github-actionsGitHub Actions

This comment has been minimized.

@A5rocks
Copy link
Collaborator

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?

@sterliakov
Copy link
CollaboratorAuthor

@A5rocks Great question. Imports are collected during parsing, and "definitely unreachable" truncation step follows (SemanticAnalyzerPreAnalysis). It does not modifyMypyFile.imports collected at the previous step, so we still treat such modules as dependencies even if the correspondingimport statement no longer exists, and "missing module" errors are produced by build manager when any dependency can't be resolved. Those imports aren't marked unreachable either. That probably should be fixed instead, thanks! That will be a better approach.

@github-actionsGitHub Actions

This comment has been minimized.

Copy link
Collaborator

@A5rocksA5rocks left a comment

Choose a reason for hiding this comment

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

This makes sense to me!

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions
Copy link
Contributor

Diff frommypy_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]

@petamasS3D
Copy link

@A5rocks ,@JukkaL
Last meaningful change is 2 weeks old on this PR - how can this be unblocked?

@sterliakov
Copy link
CollaboratorAuthor

@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.

@petamasS3D
Copy link

@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 anif around the imports, and asserting afterwards), just hoped for a quick resolution after you immediately jumped on my bug report. (Thank you for that!) I'll wait patiently until the process completes. :)

sterliakov reacted with heart emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@A5rocksA5rocksA5rocks approved these changes

@JukkaLJukkaLAwaiting requested review from JukkaL

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

mypy tries to follow imports in files with top-level sys.platform asserts on non-matching platforms
3 participants
@sterliakov@A5rocks@petamasS3D

[8]ページ先頭

©2009-2025 Movatter.jp