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

Prevent used-before-assignment for assignment via nonlocal after type annotation #6185

Merged

Conversation

jacobtylerwalls
Copy link
Member

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

I think it's important to solve the false positive instead of worrying too much about the possibility of false negatives from control-flow (for instance, if the inner function is never called).

Closes #5394

@jacobtylerwalls jacobtylerwalls added the Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer label Apr 4, 2022
@jacobtylerwalls jacobtylerwalls added this to the 2.13.5 milestone Apr 4, 2022
@Pierre-Sassoulas Pierre-Sassoulas added the False Positive 🦟 A message is emitted but nothing is wrong with the code label Apr 4, 2022
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

LGTM

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2095931612

  • 5 of 5 (100.0%) changed or added relevant lines in 1 file are covered.
  • 47 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.004%) to 94.524%

Files with Coverage Reduction New Missed Lines %
pylint/checkers/refactoring/refactoring_checker.py 12 98.25%
pylint/checkers/spelling.py 16 76.65%
pylint/lint/pylinter.py 19 95.12%
Totals Coverage Status
Change from base Build 2091745939: 0.004%
Covered Lines: 15709
Relevant Lines: 16619

πŸ’› - Coveralls

@jacobtylerwalls jacobtylerwalls merged commit 0e7aec3 into pylint-dev:main Apr 6, 2022
@jacobtylerwalls jacobtylerwalls deleted the type-annotation-nonlocal branch April 6, 2022 17:17
@Pierre-Sassoulas Pierre-Sassoulas added Backported and removed Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer labels Apr 6, 2022
Pierre-Sassoulas pushed a commit that referenced this pull request Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive used-before-assignment for type annotations that take assignment via nonlocal
4 participants