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

Variable is not defined error for f-string debug statement #686

Closed
squaresmile opened this issue Dec 4, 2020 · 2 comments
Closed

Variable is not defined error for f-string debug statement #686

squaresmile opened this issue Dec 4, 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

@squaresmile
Copy link

squaresmile commented Dec 4, 2020

Environment data

  • Language Server version: Pylance v2020.12.0
  • OS and version: Windows 10 20H2 19042.662
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.9.0

Expected behaviour

Pylance can see the variable in f-string debug statement.

Actual behaviour

<variable_name[:-1]> is not defined error is raised by Pylance

Code Snippet / Additional information

test_var = 123
print(f"{test_var=}")

Error: "test_va" is not defined Pylance(reportUndefinedVariable)

image

@github-actions github-actions bot added the triage label Dec 4, 2020
@erictraut
Copy link
Contributor

Thanks for the bug report. This will be fixed in the next release. In the meantime, you can work around the issue by inserting a space before the "=" token in the f-string expression.

@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 Dec 4, 2020
@jakebailey
Copy link
Member

This issue has been fixed in version 2020.12.1, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#2020121-9-december-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