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

Spurious error when Unicode character names used in f-string #25

Closed
t1m0thyj opened this issue Jul 2, 2020 · 2 comments
Closed

Spurious error when Unicode character names used in f-string #25

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

Comments

@t1m0thyj
Copy link

t1m0thyj commented Jul 2, 2020

Environment data

  • Language Server version: 2020.6.1
  • OS and version: Windows 10 1909
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.3 64-bit

Expected behaviour

No problems are found in the code snippet below.

Actual behaviour

Pylance finds problems because it incorrectly interprets the Unicode character \N{combining enclosing keycap} as an expression inside the f-string.

Logs

N/A

Code Snippet / Additional information

num_emojis = [f"{i}\N{combining enclosing keycap}" for i in range(1, 10)] + ["\N{keycap ten}"]

image

image

@erictraut
Copy link
Contributor

Thanks for the bug report. This isn't related to f-strings specifically. It affects other string literals too. Pyright/pylance is not properly handling escaped unicode names that contain spaces. I've fixed the problem, and it will be addressed in the next version of pyright/pylance.

@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 labels Jul 2, 2020
@jakebailey
Copy link
Member

This issue has been fixed in version 2020.7.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202070-9-july-2020

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