You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently upgraded to flake8 3.6 and pyflakes 2.0.0, and now I'm getting failures in code where locals() contains the only reference to a variable in the namespace.
draft $ cat > f841fail.py
try:
raise ValueError()
except Exception as e:
print(locals())
draft $ python f841fail.py
{'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x10138c710>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': 'f841fail.py', '__cached__': None, 'e': ValueError()}
draft $ flake8 --version
3.6.0 (mccabe: 0.6.1, pycodestyle: 2.4.0, pyflakes: 2.0.0) CPython 3.7.1 on Darwin
draft $ flake8 f841fail.py
f841fail.py:3:1: F841 local variable 'e' is assigned to but never used
draft $ pip install -U pyflakes
Requirement already up-to-date: pyflakes in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (2.0.0)
In other blocks, the use of locals() prevents F841 from being triggered. It should in exception blocks too.
The text was updated successfully, but these errors were encountered:
jaraco
added a commit
to jaraco/jaraco.mongodb
that referenced
this issue
Oct 26, 2018
I recently upgraded to flake8 3.6 and pyflakes 2.0.0, and now I'm getting failures in code where
locals()
contains the only reference to a variable in the namespace.In other blocks, the use of
locals()
prevents F841 from being triggered. It should in exception blocks too.The text was updated successfully, but these errors were encountered: