Something went wrong while setting issue due date.
F821 undefined name gives wrong line number (alwasy line 1) when variable is in an f-string
setup:
➤ flake8 --bug-report
{
"dependencies": [
{
"dependency": "setuptools",
"version": "34.2.0"
}
],
"platform": {
"python_implementation": "CPython",
"python_version": "3.6.0+",
"system": "Linux"
},
"plugins": [
{
"plugin": "mccabe",
"version": "0.6.1"
},
{
"plugin": "pycodestyle",
"version": "2.3.1"
},
{
"plugin": "pyflakes",
"version": "1.5.0"
}
],
"version": "3.3.0"
}
foobar.py:
a = 'this is a test'
b = f'this is a good fstring: {a}'
c = f'this is a bad fstring: {abc}'
➤ flake8 foobar.py
foobar.py:1:2: F821 undefined name 'abc'
You would expect the error to say line 3 not line 1.