You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Black reports an internal error with certain long f-strings as it tries to break the line in a syntactically invalid place.
To Reproduce
For example, take this code:
something= []
test_string=f"this is a really string that will be line broken at 120 chars that contains an interpolated join {",".join(something)}"
And run it with these arguments:
$ black file.py -l 120 --target-version py312
The resulting error is:
error: cannot format example.py: INTERNAL ERROR: Black produced invalid code: f-string: expecting '}' (<unknown>, line 4). Please report a bug on https://github.com/psf/black/issues. This invalid output might be helpful: /tmp/blk_9n5hjqrh.log
Oh no! 💥 💔 💥
1 file failed to reformat.
Expected behavior
The line should not be formatted/line should not be broken in an invalid position
Environment
Black's version: 24.3.0 (compiled: yes)
OS and Python version: Linux/CPython 3.12.2
Additional context
A work-around for this case is to change the ",".join(...) to ','.join(...).
The text was updated successfully, but these errors were encountered:
Describe the bug
Black reports an internal error with certain long f-strings as it tries to break the line in a syntactically invalid place.
To Reproduce
For example, take this code:
And run it with these arguments:
The resulting error is:
Expected behavior
The line should not be formatted/line should not be broken in an invalid position
Environment
Additional context
A work-around for this case is to change the
",".join(...)
to','.join(...)
.The text was updated successfully, but these errors were encountered: