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

Non-ASCII identifiers not supported #466

Closed
p-avital opened this issue Oct 7, 2020 · 8 comments
Closed

Non-ASCII identifiers not supported #466

p-avital opened this issue Oct 7, 2020 · 8 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

@p-avital
Copy link

p-avital commented Oct 7, 2020

Ever since PEP3131 (Python 3.0), non-ASCII characters are supported in identifiers (though it hasn't become a very popular feature, most people don't know that's the case). However, Pylance considers them a syntax error:

def plt_Γsplit(path):
    data: List[Dict] = parse_csv(path)
    ...

Shows multiple errors, the first of which being that ( is expected at the position where Γ is.

Any chance of a quick fix on that ? :)

@github-actions github-actions bot added the triage label Oct 7, 2020
@erictraut
Copy link
Contributor

Pylance already has full support for PEP3131. I'm not able to repro a problem with the code you posted above. Are you sure you do not have some other language server (like MPLS or Jedi) also enabled?

@erictraut erictraut added the waiting for user response Requires more information from user label Oct 7, 2020
@github-actions github-actions bot removed the triage label Oct 7, 2020
@erictraut
Copy link
Contributor

Update... I was able to repro the problem. It happens sporadically, which is very odd. I'll work on getting a consistent repro and then dig into the problem.

@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 waiting for user response Requires more information from user labels Oct 7, 2020
@p-avital
Copy link
Author

p-avital commented Oct 7, 2020

Thanks for the update, I was kinda weirded out considering I was starting from what I believe to be a clean config.
Btw very efficient issue handling, thanks for that too :)

@erictraut
Copy link
Contributor

I was able to find a consistent repro and track down the bug. The tokenizer in pylance/pyright lazily initializes the Unicode character tables that define which characters can be used legally within identifiers. It was missing this lazy initialization in one code path.

The bug is now fixed, but it's probably too late to get it into this week's pylance release. It will be in next week's release.

Thanks for reporting the problem!

@p-avital
Copy link
Author

p-avital commented Oct 7, 2020

I did not expect such reaction speeds, thanks. If you have a trick to make it work meanwhile, it'd help (and I always find tricks around edge cases fun so I'm curious).
Should I close the issue?

@erictraut
Copy link
Contributor

Please leave it open for now. We'll close it once we release the fix.

If the first character in your identifier is a non-ASCII character, it will properly initialize the Unicode tables. All of my unit tests were constructed this way, which is why I missed this case.

If you're curious about the change, it's here.

@jakebailey
Copy link
Member

Yeah, it didn't quite make it into this release. Next week, definitely.

@jakebailey
Copy link
Member

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