
Fixes #593 I looked into this bug with @ambv and @carljm, and we reached the conclusion was that it's not possible for the tokenizer to determine if async/await is a keyword inside all possible generators without breaking the grammar for older versions of Python. Instead, we introduce a new tokenizer mode for Python 3.7+ that will cause all async/await instances to get parsed as a reserved keyword, which should fix async/await inside generators.
50 lines
495 B
Python
50 lines
495 B
Python
def async():
|
|
pass
|
|
|
|
|
|
def await():
|
|
pass
|
|
|
|
|
|
await = lambda: None
|
|
async = lambda: None
|
|
async()
|
|
await()
|
|
|
|
|
|
def sync_fn():
|
|
await = lambda: None
|
|
async = lambda: None
|
|
async()
|
|
await()
|
|
|
|
|
|
async def async_fn():
|
|
await async_fn()
|
|
|
|
|
|
# output
|
|
def async():
|
|
pass
|
|
|
|
|
|
def await():
|
|
pass
|
|
|
|
|
|
await = lambda: None
|
|
async = lambda: None
|
|
async()
|
|
await()
|
|
|
|
|
|
def sync_fn():
|
|
await = lambda: None
|
|
async = lambda: None
|
|
async()
|
|
await()
|
|
|
|
|
|
async def async_fn():
|
|
await async_fn()
|