Pylance-release: Spurious error when Unicode character names used in f-string

Created on 2 Jul 2020  路  2Comments  路  Source: microsoft/pylance-release

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

bug fixed in next version

All 2 comments

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.

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

Was this page helpful?
0 / 5 - 0 ratings