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 FP in finally #9451

Closed
jacobtylerwalls opened this issue Feb 21, 2024 · 0 comments · Fixed by #9452
Closed

used-before-assignment FP in finally #9451

jacobtylerwalls opened this issue Feb 21, 2024 · 0 comments · Fixed by #9452
Labels
C: used-before-assignment Issues related to 'used-before-assignment' check False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@jacobtylerwalls
Copy link
Member

Bug description

# pylint: disable=missing-module-docstring,missing-function-docstring,bare-except
def good():
    try:
        status = 1
    except:
        status = 2
    finally:
        print(status)

Configuration

No response

Command used

pylint a.py

Pylint output

a.py:7:14: E0601: Using variable 'status' before assignment (used-before-assignment)

Expected behavior

no msg

Pylint version

pylint 3.1.0-dev0
astroid 3.1.0-dev0
Python 3.12.1 (v3.12.1:2305ca5144, Dec  7 2023, 17:23:38) [Clang 13.0.0 (clang-1300.0.29.30)]

OS / Environment

No response

Additional dependencies

No response

@jacobtylerwalls jacobtylerwalls added False Positive 🦟 A message is emitted but nothing is wrong with the code C: used-before-assignment Issues related to 'used-before-assignment' check Needs PR This issue is accepted, sufficiently specified and now needs an implementation labels Feb 21, 2024
@jacobtylerwalls jacobtylerwalls added this to the 3.0.4 milestone Feb 22, 2024
github-actions bot pushed a commit that referenced this issue Feb 22, 2024
jacobtylerwalls added a commit that referenced this issue Feb 22, 2024
Closes #9451

(cherry picked from commit a83e6b9)

Co-authored-by: Jacob Walls <[email protected]>
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 Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant