Open
Description
Bug description
# pylint: disable=missing-docstring
def foobar(x):
if x not in ["A"]:
v = []
if x == "B":
print(v)
elif x == "A":
v = []
else:
raise RuntimeError(f'{x}')
Configuration
Command used
pylint pylint_repro.py
Pylint output
************* Module pylint_repro
pylint_repro.py:8:14: E0601: Using variable 'v' before assignment (used-before-assignment)
------------------------------------------------------------------
Your code has been rated at 3.75/10 (previous run: 0.00/10, +3.75)
Expected behavior
Preferably no errors at all, but failing that, the error should be possibly-used-before-assignment
, not used-before-assignment
.
Pylint version
pylint 3.3.3
astroid 3.3.8
Python 3.12.3 (main, Nov 6 2024, 18:32:19) [GCC 13.2.0]
OS / Environment
Ubuntu 24.04.