Open octaviancorlade opened 1 month ago
The name consumption logic is a little wonky. If the variable which would be undefined in the except
block is used at all in the try
block, the warning is not raised.
A self-contained example:
try:
x = 1 / 0
except ZeroDivisionError:
print(x) # triggers used-before-assignment
try:
y = 1 / 0
print(y)
except ZeroDivisionError:
print(y) # no warning -- false negative
Bug description
This is highlighted as expected
This is not
Command used
Pylint output
Expected behavior
Pylint version
Additional dependencies