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

F541 deletes fstring w/o adding additional whitespace #5281

Closed
jasikpark opened this issue Jun 22, 2023 · 2 comments · Fixed by #5319
Closed

F541 deletes fstring w/o adding additional whitespace #5281

jasikpark opened this issue Jun 22, 2023 · 2 comments · Fixed by #5319
Assignees
Labels
bug Something isn't working

Comments

@jasikpark
Copy link

With this program:

(""f""r"")
g=""f"{'{:f'}"#

F541 deletes the f in the first fstring and does not add whitespace, producing an invalid doc

thread '<unnamed>' panicked at 'Fixed source has a syntax error where the source document does not. This is a bug in one of the generated fixes:
<filename>:2:16: E999 SyntaxError: unexpected EOF while parsing
  |
1 | (""""r"")
2 | g=""f"{'{:f'}"#
  |                 E999
  |


Last generated fixes:
<filename>:1:4: F541 [*] f-string without any placeholders
  |
1 | (""f""r"")
  |    ^^^ F541
2 | g=""f"{'{:f'}"#
  |
  = help: Remove extraneous `f` prefix

ℹ Fix
1   |-(""f""r"")
  1 |+(""""r"")
2 2 | g=""f"{'{:f'}"#


Source with applied fixes:
(""""r"")
g=""f"{'{:f'}"#'

found via #4822, on main (1c0a3a4)

@charliermarsh charliermarsh added the bug Something isn't working label Jun 22, 2023
@charliermarsh
Copy link
Member

Thanks! Looks a bit like #4827.

@jasikpark
Copy link
Author

indeed!

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

Successfully merging a pull request may close this issue.

2 participants