Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string_processing: Error when re-flowing implicitly concatenated r-strings #3855

Open
Feuermurmel opened this issue Aug 27, 2023 · 0 comments
Labels
C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. F: strings Related to our handling of strings T: bug Something isn't working

Comments

@Feuermurmel
Copy link

Feuermurmel commented Aug 27, 2023

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).

@Feuermurmel Feuermurmel added the T: bug Something isn't working label Aug 27, 2023
@JelleZijlstra JelleZijlstra added C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. F: strings Related to our handling of strings labels Aug 27, 2023
@psf psf deleted a comment Oct 28, 2023
@JelleZijlstra JelleZijlstra changed the title Error when re-flowing implicitly concatenated r-strings string_processing: Error when re-flowing implicitly concatenated r-strings Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. F: strings Related to our handling of strings T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants