Skip to content

possibly-used-before-assignment doesn't understand never-returning-functions #9627

Closed
@chrisburr

Description

@chrisburr

Bug description

# pylint: disable=missing-module-docstring,invalid-name
import sys

if input("Enter something or nothing: "):
    sys.exit()
else:
    a = 1
print(a)

Configuration

No response

Command used

pylint test.py

Pylint output

************* Module test
test.py:8:6: E0606: Possibly using variable 'a' before assignment (possibly-used-before-assignment)

Expected behavior

Branches which end in a function which never returns shouldn't be considered as possible causes of never defined variables.

Pylint version

pylint 3.2.0
astroid 3.2.0
Python 3.11.7 | packaged by conda-forge | (main, Dec 23 2023, 14:43:09) [GCC 12.3.0]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

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