-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
C: preview styleIssues with the preview and unstable style. Add the name of the responsible feature in the title.Issues with the preview and unstable style. Add the name of the responsible feature in the title.F: stringsRelated to our handling of stringsRelated to our handling of stringsT: bugSomething isn't workingSomething isn't working
Description
Describe the bug
Trying to format the following input (playground) with black -l 1 --preview leads to an error:
dict(a=r' ' r'')$ black -l 1 --preview foo.py
error: cannot format foo.py: Cannot parse: 5:4: r""
Oh no! 💥 💔 💥
1 file failed to reformat.
Some additional variants that lead to the same error:
dict(a=r' ' '')
dict(a=r' ' " ")The error does not appear if --preview is not used. The file is formatted correctly in that case.
Environment
- Black's version: 23.7.0 (compiled: yes)
- OS and Python version: Python 3.8.18 on macOS 12.6.8 (Apple Silicon)
Also fails in the playground using the current main version (see above).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C: preview styleIssues with the preview and unstable style. Add the name of the responsible feature in the title.Issues with the preview and unstable style. Add the name of the responsible feature in the title.F: stringsRelated to our handling of stringsRelated to our handling of stringsT: bugSomething isn't workingSomething isn't working