Closed
Description
Bug description
def foo(l):
for i in l:
break
else:
return
print(i)
Configuration
No response
Command used
pylint test.py
Pylint output
************* Module test
test.py:6:10: W0631: Using possibly undefined loop variable 'i' (undefined-loop-variable)
Expected behavior
no error
Pylint version
pylint 2.13.0
astroid 2.11.1
Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)]
OS / Environment
No response
Additional dependencies
No response