Skip to content

Undefined name in f-string following non-blank lines is reported as though on Line 1 #114

Description

@kkurian

Problem

When an f-string follows any number of non-blank lines, an undefined name in the f-string is reported as an error on Line 1 rather than as an error on the line of the f-string itself.

Input

import re
f'{foo}'

Result

One error marker on Line 1, the error being:

flake8: F401 're' imported by unused / F821 undefined name 'foo', Line 1, Column 10

Expected Result

An error marker on Line 1 for the F401 error.
An error marker on Line 2 for the F821 error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions