-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
C: undefined-variableIssues related to 'undefined-variable' checkIssues related to 'undefined-variable' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Bug description
from typing import NoReturn
def fail() -> NoReturn:
...
def foo(l):
while True:
for i in l:
break
else:
continue
# or break
# or fail()
print(i)
this is the same issue as #5971, though it seems to have only been fixed for return
statements but not break
, continue
statements or function calls that return NoReturn
or Never
Configuration
No response
Command used
pylint test.py
Pylint output
************* Module test
test.py:8:14: W0631: Using possibly undefined loop variable 'i' (undefined-loop-variable)
Expected behavior
no error
Pylint version
pylint 2.14.5
astroid 2.11.7
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
OS / Environment
No response
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
C: undefined-variableIssues related to 'undefined-variable' checkIssues related to 'undefined-variable' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation