Skip to content

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

Closed
@Torom

Description

@Torom

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationpy-versionpython 3.12

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions