-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
F: stringsRelated to our handling of stringsRelated to our handling of stringsT: bugSomething isn't workingSomething isn't working
Description
Describe the bug
black hangs (or takes an extremely long time?) to process a file with a multiline f-string containing a bunch of escaped quotation marks.
To Reproduce
Run black against this file:
def testing():
somevar = "some value"
return f"""
{somevar} the following line causes the issue:
\" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \"
"""Will just hang without any output.
Expected behavior
Should run to completion within at most 1 second.
Environment
- Black's version: 24.10.0 (was working with 24.4.2, probably introduced in 24.8.0)
- OS and Python version: macOS/Python 3.13.0
Additional context
Extracting the quotes into a variable seems to circumvent the issue:
def testing():
somevar = "some value"
quotes = """\" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \" \""""
return f"""
{somevar} the following line causes the issue:
{quotes}
"""Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
F: stringsRelated to our handling of stringsRelated to our handling of stringsT: bugSomething isn't workingSomething isn't working