PyCQA / pycodestyle

Simple Python style checker in one Python file
https://pycodestyle.pycqa.org
Other
5.01k stars 755 forks source link

f-string varialbes shows wrong E251 and E202 since python 3.12 upgrade #1243

Closed gituser789 closed 3 months ago

gituser789 commented 3 months ago

Since upgrading to python 3.12, there are new hints, which have not been there using pycodestyle together with python 3.11:

print(f"{my_variable = }")

raises

E251 unexpected spaces around keyword / parameter equals
E202 whitespace before '}'

As it makes a difference in displaying, for different formats, there are different display outputs with/without spaces print(f"{my_variable = }") -> my_variable = 5 print(f"{my_variable=}") -> my_variable=5

In the f-string case, the spaces are wanted. When ignoring E251 and E202, the hints are missing in real functions if the space is missing.

asottile commented 3 months ago

please search for duplicates

gituser789 commented 3 months ago

Sorry, was not aware of the wanted behavior, since it wasn't in older versions using the same code. Duplicates:

1190

1201

1224