Skip to content

used-before-assignment FP in finally #9451

@jacobtylerwalls

Description

@jacobtylerwalls

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: used-before-assignmentIssues related to 'used-before-assignment' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions