-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkControl flowRequires control flow understandingRequires control flow understandingFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the code
Milestone
Description
Bug description
The used-before-assignment
check reports a false positive with try/else/continue starting with pylint 2.13.0.
This issue is nearly identical to #6790, except it involves continue
instead of return
.
"""bug.py"""
def demo():
"""Demonstrate used-before-assignment regression in pylint==2.13.0 and 2.14.0."""
for _temp in range(0, 1):
try:
pass
except ValueError:
error = True
else:
continue
print(error)
Configuration
No response
Command used
pylint bug.py
Pylint output
************* Module bug
bug.py:14:14: E0601: Using variable 'error' before assignment (used-before-assignment)
Expected behavior
No errors reported, as was the case for 2.12.2.
Pylint version
pylint 2.14.0
astroid 2.11.5
Python 3.9.5 (default, Nov 23 2021, 15:27:38)
[GCC 9.3.0]
OS / Environment
Ubuntu 22.04.4
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
C: used-before-assignmentIssues related to 'used-before-assignment' checkIssues related to 'used-before-assignment' checkControl flowRequires control flow understandingRequires control flow understandingFalse Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the code