Incorrect 'undefined name' in presence of conditional del statement
Bug #1212912 reported by
Steve Leonard
This bug report is a duplicate of:
Bug #885140: using del in if clause confuses pyflakes.
Edit
Remove
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
New
|
Wishlist
|
Unassigned |
Bug Description
Reproducible with this code:
# example.py
x = 7
if False:
del x
else:
print x
$>pyflakes example.py
example.py:5: undefined name 'x'
# This corresponds to the line 'print x'
$>pyflakes --version
0.7.3
To post a comment you must log in.
Thank you for the report.
This case is not easy to support with Pyflakes.
The workaround is to refactor the source code which gives a false positive.