Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ast gets the wrong column information for interpolated code in multiline f-strings #94869

Closed
Assignees
pablogsal
Labels
type-bugAn unexpected behavior, bug, or error
@martindemello

Description

@martindemello

Bug report

When parsing multiline f-strings, e.g.

a = f"""     {test}    """

the ast has the wrong column information fortest. Here's the diff between 3.9.12 (lhs, gets it wrong) and 3.9.1 (gets it right).

     FormattedValue(                                                 FormattedValue(      value=Name(                                                     value=Name(       id='test',                                                      id='test',       ctx=Load(),                                                     ctx=Load(),           lineno=2,                                                       lineno=2,        col_offset=11,                                         |        col_offset=7,                                         end_lineno=2,                                                   end_lineno=2,                                         end_col_offset=15),                                    |        end_col_offset=11),

Your environment

Tested on a variety of python versions (on linux); 3.9.1 gets it right, it's wrong in 3.9.2 and has the same wrong value all the way to 3.9.12. The offset seems related to the start column of the opening triple quotes. I went through previous f-string parsing bugs but this does not look like a duplicate of any of them.

Metadata

Metadata

Assignees

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp