-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
T: bugSomething isn't workingSomething isn't working
Description
The code await ... crashes the parser with error: cannot format <string>: '...' locally / misparses into '...' online (not sure why the difference here, I think directly running __init__.py has more dev checks enabled?).
This happens because tokenize.tokenize has this structure (taking some creative liberties with the yields):
for token in token_iterator:
if token.type == TokenType.identifier and token_str in ("async", "await"):
yield current_token
yield next_token
continue
if token.type == TokenType.op and token_str == "...":
# convert the `...` to three `.` tokens
yield new_token # x3
continueThis means that on an await token, the next token bypasses the ... check, so the parser gets an op ... instead of the expected 3x . ops.
I'm not sure how to best fix this without making a big mess of the code, @tusharsadhwani please help.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
T: bugSomething isn't workingSomething isn't working