Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W1405: inconsistent-quotes does not respect py-version #9113

Closed
Torom opened this issue Oct 4, 2023 · 0 comments · Fixed by #9152
Closed

W1405: inconsistent-quotes does not respect py-version #9113

Torom opened this issue Oct 4, 2023 · 0 comments · Fixed by #9152
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation py-version python 3.12
Milestone

Comments

@Torom
Copy link

Torom commented Oct 4, 2023

Bug description

Since Python 3.12, the same quotes can be used in f-strings as were used for the outer string itself. Pylint correctly points out that inconsistent quote styles have been used if this is not done. However, it does not take into account the configured py-version, so it also warns for Python versions < 3.12 when the test is performed with Python 3.12.

dictionary = {'0': 0}
f_string = f'{dictionary["0"]}'

Configuration

py-version=3.10

Command used

pylint a.py

Pylint output

************* Module a
a.py:2:0: W1405: Quote delimiter " is inconsistent with the rest of the file (inconsistent-quotes)

Expected behavior

As far as I understand it, pylint should only give this warning if the py-version is >= 3.12.

Pylint version

pylint 3.0.0
astroid 3.0.0
Python 3.12.0 (main, Oct  3 2023, 22:08:15) [GCC 13.2.1 20230801]
@Torom Torom added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Oct 4, 2023
@jacobtylerwalls jacobtylerwalls added False Positive 🦟 A message is emitted but nothing is wrong with the code py-version Needs PR This issue is accepted, sufficiently specified and now needs an implementation python 3.12 and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 4, 2023
@Pierre-Sassoulas Pierre-Sassoulas added this to the 3.0.2 milestone Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation py-version python 3.12
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants