-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
"EOF in multi-line string" on string containing same quote nested in f-string #4350
Labels
T: bug
Something isn't working
Comments
Feuermurmel
changed the title
"Cannot parse" on string containing same quote nested in f-strings
"EOF in multi-line string" on string containing same quote nested in f-strings
May 5, 2024
Feuermurmel
changed the title
"EOF in multi-line string" on string containing same quote nested in f-strings
"EOF in multi-line string" on string containing same quote nested in f-string
May 5, 2024
I guess it because backslash() aren't allowed in f-string brackets. You can use the double backslash if you want it on the string |
They are allowed since Python 3.12: https://godbolt.org/z/9zGsezrEh |
hauntsaninja
added a commit
to hauntsaninja/black
that referenced
this issue
May 16, 2024
hauntsaninja
added a commit
to hauntsaninja/black
that referenced
this issue
May 16, 2024
hauntsaninja
added a commit
to hauntsaninja/black
that referenced
this issue
May 16, 2024
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
black
cannot format this type of code:f"{'\''}"
I was thinking that it might be the same bug as #4334, but the example in that issue (
f'{'a'}'
) doesn't produce an error in black 24.4.2 anymore, and Python 3.12.2 accepts the above code:To Reproduce
Playground
Expected behavior
I have no opinion on how this should be formatted. Leaving this code as it is would be fine.
Environment
macOS 12.7.4 (21H1123)
The text was updated successfully, but these errors were encountered: