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

[used-before-assignment] Functions defined in type-checking guard not flagged when used later #10028

Open
jacobtylerwalls opened this issue Oct 16, 2024 · 1 comment
Labels
C: used-before-assignment Issues related to 'used-before-assignment' check False Negative 🦋 No message is emitted but something is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation

Comments

@jacobtylerwalls
Copy link
Member

In #9990, we discovered that extending the fix for false negatives for used-before-assignment for objects guarded behind type-checking blocks to include functions would cause a handful of false positives in the primer. So we backed out that change and opened this issue to investigate.

@zenlyj graciously offered to find time to look into it.

@jacobtylerwalls jacobtylerwalls added C: used-before-assignment Issues related to 'used-before-assignment' check False Negative 🦋 No message is emitted but something is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation labels Oct 16, 2024
@zenlyj
Copy link
Contributor

zenlyj commented Oct 17, 2024

will also look at this unused-import false negative that @nickdrozd found.

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from math import pi  # unused-import false negative

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: used-before-assignment Issues related to 'used-before-assignment' check False Negative 🦋 No message is emitted but something is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

No branches or pull requests

2 participants