You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like parso's tokenizer unconditionally treats async and await as keywords under 3.6. However, while that's valid on 3.7+, on 3.6 it's conditionally treated as a keyword or identifier depending on if you're inside an async function.
It might not be worth supporting because it's an older version of Python, and the hacks required to support it are pretty ugly, but I figured I'd upstream this issue.
The text was updated successfully, but these errors were encountered:
I think I had some discussions about this before. Not sure if it was in this issue tracker, but we ended up with the current solution for these reasons:
Using async/await as an identifier will be a syntax error in the future, so people should fix it now
The complexity was just not worth the benefit.
It's quite a bit of work. Especially because parso supports error recovery and finding all the edge cases where the tokenizer might fail is annoying.
So if you don't mind, I would close this. In a bit more than two years 3.6 will be end of life and there's a good chance that we'll drop support anyway.
I personally won't do the work, there are more important things to do. But if you want to do this, I would consider accepting a patch. It's definitely possible.
It looks like parso's tokenizer unconditionally treats
async
andawait
as keywords under 3.6. However, while that's valid on 3.7+, on 3.6 it's conditionally treated as a keyword or identifier depending on if you're inside an async function.Black has some logic to support this behavior when parsing as <3.7: https://github.com/psf/black/blob/40e8b3a231bade22d838858435a33d60a8325306/blib2to3/pgen2/tokenize.py#L359
This was reported by @zhammer on Instagram/LibCST#32
It might not be worth supporting because it's an older version of Python, and the hacks required to support it are pretty ugly, but I figured I'd upstream this issue.
The text was updated successfully, but these errors were encountered: