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

formatter should change f strings using single quotes with nested double quotes to use double quotes when target-version is py312 #13237

Closed
Tracked by #13371
DetachHead opened this issue Sep 4, 2024 · 1 comment · Fixed by #13860
Labels
bug Something isn't working formatter Related to the formatter preview Related to preview mode features

Comments

@DetachHead
Copy link

on older python versions, the following code is a syntax error:

f"{""}"

which is why the formatter does not convert the following f string to use double quotes:

f'{""}'

but on python 3.12, it's allowed, so the formatter should always convert them to double quotes. playground

@dhruvmanila
Copy link
Member

This is available under preview style (#9785) although it seems like the formatter still doesn't change the outer quote. For example, if the quotes are inverted (f"{''}"), the formatter changes the inner quote to use double quotes. This case (f'{""}') seems like a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatter Related to the formatter preview Related to preview mode features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants