]> granicus.if.org Git - python/commit
Issue #24619: New approach for tokenizing async/await.
authorYury Selivanov <yselivanov@sprymix.com>
Wed, 22 Jul 2015 10:33:45 +0000 (13:33 +0300)
committerYury Selivanov <yselivanov@sprymix.com>
Wed, 22 Jul 2015 10:33:45 +0000 (13:33 +0300)
commit8fb307cd650511ba019c4493275cb6684ad308bc
treedc1138644436a3e2c0592f096c6b8d0e47aec5ef
parent80acc3ebbc4c81f9c1bff864eca076d6bdbe9ec6
Issue #24619: New approach for tokenizing async/await.

This commit fixes how one-line async-defs and defs are tracked
by tokenizer.  It allows to correctly parse invalid code such
as:

>>> async def f():
...     def g(): pass
...     async = 10

and valid code such as:

>>> async def f():
...     async def g(): pass
...     await z

As a consequence, is is now possible to have one-line
'async def foo(): await ..' functions:

>>> async def foo(): return await bar()
13 files changed:
Doc/reference/compound_stmts.rst
Lib/lib2to3/pgen2/tokenize.py
Lib/test/badsyntax_async1.py
Lib/test/badsyntax_async2.py
Lib/test/badsyntax_async4.py
Lib/test/badsyntax_async9.py [deleted file]
Lib/test/test_coroutines.py
Lib/test/test_grammar.py
Lib/test/test_tokenize.py
Lib/tokenize.py
Misc/NEWS
Parser/tokenizer.c
Parser/tokenizer.h