E275: false positive with f-strings in Python 3.12
ThiefMaster opened this issue · 1 comments
ThiefMaster commented
[adrian@eluvian:/tmp]> ./testenv-312/bin/flake8 --version
6.1.0 (mccabe: 0.7.0, pycodestyle: 2.11.0, pyflakes: 3.1.0) CPython 3.12.0 on Linux
[adrian@eluvian:/tmp]> ./testenv-311/bin/flake8 --version
6.1.0 (mccabe: 0.7.0, pycodestyle: 2.11.0, pyflakes: 3.1.0) CPython 3.11.6 on Linux
[adrian@eluvian:/tmp]> cat util.py
def bug(wtf):
return f'in{wtf}'
[adrian@eluvian:/tmp]> ./testenv-311/bin/flake8 util.py
[adrian@eluvian:/tmp]> ./testenv-312/bin/flake8 util.py
util.py:2:16: E275 missing whitespace after keyword
For some reason it seems to expect a space before the {...}
inside the f-string. of course this makes no sense, since that would change the resulting string.
ThiefMaster commented
Actually, this seems to happen only if the string part happens to be a valid Python operator. f'lol{wtf}'
doesn't trigger the bug, but f'not{wtf}'
, f'def{wtf}'
, etc. do.