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

use '"' and !r in f-string detected Unexpected token at end of expression #1584

Closed
nanarino opened this issue Jul 22, 2021 · 2 comments
Closed
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@nanarino
Copy link

Environment data

  • Language Server version: v2021.7.22
  • OS and version: Win10
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9

Expected behaviour

s = "#M's#"
print(f"""{s.replace("'",'')}""") # ok
print(f"""{s.replace("'",'')!r}""") # Unexpected token at end of expression
import datetime
print(f"""{datetime.datetime.now().isoformat(sep="'")}""")  # ok
print(f"""{datetime.datetime.now().isoformat(sep="'")!r}""") # Unexpected token at end of expression

Actual behaviour

I actually use it to splice sqlite3 comman,the quotation marks need to be replaced
Normal output and sqlite3 used ok

@erictraut
Copy link
Contributor

Thanks for the bug report. This will be fixed in the next release.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage labels Jul 22, 2021
@jakebailey
Copy link
Member

This issue has been fixed in version 2021.7.5, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202175-22-july-2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants