Skip to content

f-string-without-interpolation false positive with t-strings when using format spec #10702

@matgrioni

Description

@matgrioni

Bug description

When passing any format specs to t-strings, an f-string-without-interpolation warning will be filed.

Consider the following snippet:

def f():
    pi = 3.14
    return t"{pi:.1f}"


The template string line will be flagged by lint as having the f-string-without-interpolation issue.

Configuration

Command used

python -m pylint test.py

Pylint output

************* Module test
test.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test.py:1:0: C0116: Missing function or method docstring (missing-function-docstring)
test.py:3:16: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)

Expected behavior

Expected behavior is for no linting error to be raised on format spec provided with template string.

Pylint version

pylint 4.0.2
astroid 4.0.1
Python 3.14.0 (main, Oct 19 2025, 09:04:15) [GCC 13.3.0]

OS / Environment

WSL 2: Ubuntu 24.04.1 LTS

Additional dependencies

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 implementation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions