mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
bpo-30406: Make async and await proper keywords (#1669)
Per PEP 492, 'async' and 'await' should become proper keywords in 3.7.
This commit is contained in:
parent
2084b30e54
commit
ac317700ce
22 changed files with 419 additions and 623 deletions
|
|
@ -759,7 +759,7 @@ def"', """\
|
|||
""")
|
||||
|
||||
self.check_tokenize("async def foo(): pass", """\
|
||||
ASYNC 'async' (1, 0) (1, 5)
|
||||
NAME 'async' (1, 0) (1, 5)
|
||||
NAME 'def' (1, 6) (1, 9)
|
||||
NAME 'foo' (1, 10) (1, 13)
|
||||
OP '(' (1, 13) (1, 14)
|
||||
|
|
@ -776,7 +776,7 @@ async def foo():
|
|||
await
|
||||
async += 1
|
||||
''', """\
|
||||
ASYNC 'async' (1, 0) (1, 5)
|
||||
NAME 'async' (1, 0) (1, 5)
|
||||
NAME 'def' (1, 6) (1, 9)
|
||||
NAME 'foo' (1, 10) (1, 13)
|
||||
OP '(' (1, 13) (1, 14)
|
||||
|
|
@ -787,12 +787,12 @@ async += 1
|
|||
NAME 'def' (2, 2) (2, 5)
|
||||
NAME 'foo' (2, 6) (2, 9)
|
||||
OP '(' (2, 9) (2, 10)
|
||||
AWAIT 'await' (2, 10) (2, 15)
|
||||
NAME 'await' (2, 10) (2, 15)
|
||||
OP ')' (2, 15) (2, 16)
|
||||
OP ':' (2, 16) (2, 17)
|
||||
NEWLINE '\\n' (2, 17) (2, 18)
|
||||
INDENT ' ' (3, 0) (3, 4)
|
||||
AWAIT 'await' (3, 4) (3, 9)
|
||||
NAME 'await' (3, 4) (3, 9)
|
||||
OP '=' (3, 10) (3, 11)
|
||||
NUMBER '1' (3, 12) (3, 13)
|
||||
NEWLINE '\\n' (3, 13) (3, 14)
|
||||
|
|
@ -802,7 +802,7 @@ async += 1
|
|||
OP ':' (4, 6) (4, 7)
|
||||
NEWLINE '\\n' (4, 7) (4, 8)
|
||||
INDENT ' ' (5, 0) (5, 4)
|
||||
AWAIT 'await' (5, 4) (5, 9)
|
||||
NAME 'await' (5, 4) (5, 9)
|
||||
NEWLINE '\\n' (5, 9) (5, 10)
|
||||
DEDENT '' (6, 0) (6, 0)
|
||||
DEDENT '' (6, 0) (6, 0)
|
||||
|
|
@ -815,7 +815,7 @@ async += 1
|
|||
self.check_tokenize('''\
|
||||
async def foo():
|
||||
async for i in 1: pass''', """\
|
||||
ASYNC 'async' (1, 0) (1, 5)
|
||||
NAME 'async' (1, 0) (1, 5)
|
||||
NAME 'def' (1, 6) (1, 9)
|
||||
NAME 'foo' (1, 10) (1, 13)
|
||||
OP '(' (1, 13) (1, 14)
|
||||
|
|
@ -823,7 +823,7 @@ async def foo():
|
|||
OP ':' (1, 15) (1, 16)
|
||||
NEWLINE '\\n' (1, 16) (1, 17)
|
||||
INDENT ' ' (2, 0) (2, 2)
|
||||
ASYNC 'async' (2, 2) (2, 7)
|
||||
NAME 'async' (2, 2) (2, 7)
|
||||
NAME 'for' (2, 8) (2, 11)
|
||||
NAME 'i' (2, 12) (2, 13)
|
||||
NAME 'in' (2, 14) (2, 16)
|
||||
|
|
@ -834,14 +834,14 @@ async def foo():
|
|||
""")
|
||||
|
||||
self.check_tokenize('''async def foo(async): await''', """\
|
||||
ASYNC 'async' (1, 0) (1, 5)
|
||||
NAME 'async' (1, 0) (1, 5)
|
||||
NAME 'def' (1, 6) (1, 9)
|
||||
NAME 'foo' (1, 10) (1, 13)
|
||||
OP '(' (1, 13) (1, 14)
|
||||
ASYNC 'async' (1, 14) (1, 19)
|
||||
NAME 'async' (1, 14) (1, 19)
|
||||
OP ')' (1, 19) (1, 20)
|
||||
OP ':' (1, 20) (1, 21)
|
||||
AWAIT 'await' (1, 22) (1, 27)
|
||||
NAME 'await' (1, 22) (1, 27)
|
||||
""")
|
||||
|
||||
self.check_tokenize('''\
|
||||
|
|
@ -866,7 +866,7 @@ def f():
|
|||
OP ':' (3, 11) (3, 12)
|
||||
NAME 'pass' (3, 13) (3, 17)
|
||||
NEWLINE '\\n' (3, 17) (3, 18)
|
||||
ASYNC 'async' (4, 2) (4, 7)
|
||||
NAME 'async' (4, 2) (4, 7)
|
||||
NAME 'def' (4, 8) (4, 11)
|
||||
NAME 'bar' (4, 12) (4, 15)
|
||||
OP '(' (4, 15) (4, 16)
|
||||
|
|
@ -888,7 +888,7 @@ async def f():
|
|||
async def bar(): pass
|
||||
|
||||
await = 2''', """\
|
||||
ASYNC 'async' (1, 0) (1, 5)
|
||||
NAME 'async' (1, 0) (1, 5)
|
||||
NAME 'def' (1, 6) (1, 9)
|
||||
NAME 'f' (1, 10) (1, 11)
|
||||
OP '(' (1, 11) (1, 12)
|
||||
|
|
@ -904,7 +904,7 @@ async def f():
|
|||
OP ':' (3, 11) (3, 12)
|
||||
NAME 'pass' (3, 13) (3, 17)
|
||||
NEWLINE '\\n' (3, 17) (3, 18)
|
||||
ASYNC 'async' (4, 2) (4, 7)
|
||||
NAME 'async' (4, 2) (4, 7)
|
||||
NAME 'def' (4, 8) (4, 11)
|
||||
NAME 'bar' (4, 12) (4, 15)
|
||||
OP '(' (4, 15) (4, 16)
|
||||
|
|
@ -913,7 +913,7 @@ async def f():
|
|||
NAME 'pass' (4, 19) (4, 23)
|
||||
NEWLINE '\\n' (4, 23) (4, 24)
|
||||
NL '\\n' (5, 0) (5, 1)
|
||||
AWAIT 'await' (6, 2) (6, 7)
|
||||
NAME 'await' (6, 2) (6, 7)
|
||||
OP '=' (6, 8) (6, 9)
|
||||
NUMBER '2' (6, 10) (6, 11)
|
||||
DEDENT '' (7, 0) (7, 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue