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: f-strings with quoted debug expressions #4493

Open
MichaReiser opened this issue Oct 22, 2024 · 0 comments
Open

string-processing: f-strings with quoted debug expressions #4493

MichaReiser opened this issue Oct 22, 2024 · 0 comments
Labels
F: strings Related to our handling of strings T: bug Something isn't working

Comments

@MichaReiser
Copy link

Describe the bug

The string-processing produces an invalid f-string when joining together two strings where both literals have a debug expression with quotes

f"{10 + len('bar')=}" f'{10 + len("bar")=}'
Cannot parse for target version Python 3.13: 2:30: f"{10 + len('bar')=}{10 + len(\"bar\")=}"

To Reproduce

Playground

Expected behavior

Black shouldn't join f-strings containing debug expressions with different quotes because changing the quotes would change the runtime behavior (the printed expressions use different quotes)

@MichaReiser MichaReiser added the T: bug Something isn't working label Oct 22, 2024
@MichaReiser MichaReiser changed the title string-processing: Quoted debug expressions string-processing: f-strings with quoted debug expressions Oct 22, 2024
@JelleZijlstra JelleZijlstra added the F: strings Related to our handling of strings label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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