Skip to content

code inside fstring not getting formatted #3213

@jerryc05

Description

@jerryc05

Describe the bug

code inside fstring not getting formatted
To Reproduce

For example, take this code:

def fff():
    return 0
    
    
print(   f"asdasd {   fff  ()   } dasdasd"     )

And run it with https://black.vercel.app/?version=main:

The result is:

def fff():
    return 0


print(f"asdasd {   fff  ()   } dasdasd")

Expected behavior

def fff():
    return 0


print(f"asdasd {fff()} dasdasd")

Environment

  • Black's version:
  • OS and Python version:

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: parserHow we parse code. Or fail to parse it.F: stringsRelated to our handling of stringsR: duplicateThis issue or pull request already existsT: bugSomething isn't working
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions