Fix More 3.6 async parsing

... all from 3.6 test_coroutines.py.

More bugs remain
This commit is contained in:
rocky
2022-05-05 07:36:06 -04:00
parent c5efec1e6f
commit 8576117d00
4 changed files with 41 additions and 2 deletions

Binary file not shown.

View File

@@ -0,0 +1,39 @@
# These are from 3.6 test_coroutines.py
async def iterate(gen):
res = []
async for i in gen:
res.append(i)
return res
def test_comp_5(f):
# async def f(it):
# for i in it:
# yield i
async def run_list():
return [i
for
pair in
([10, 20])
async for i
in f
]
async def test2(x, buffer, f):
with x:
async for i in f:
if i:
break
else:
buffer()
buffer()
async def test3(x, buffer, f):
with x:
async for i in f:
if i:
continue
buffer()
else:
buffer.append()
buffer()

View File

@@ -135,7 +135,7 @@ class Python36Parser(Python35Parser):
POP_BLOCK JUMP_FORWARD COME_FROM_EXCEPT DUP_TOP POP_BLOCK JUMP_FORWARD COME_FROM_EXCEPT DUP_TOP
LOAD_GLOBAL COMPARE_OP POP_JUMP_IF_TRUE LOAD_GLOBAL COMPARE_OP POP_JUMP_IF_TRUE
END_FINALLY COME_FROM END_FINALLY COME_FROM
for_block for_block _come_froms
POP_TOP POP_TOP POP_TOP POP_EXCEPT POP_TOP POP_TOP POP_TOP POP_TOP POP_EXCEPT POP_TOP
POP_BLOCK POP_BLOCK
else_suite COME_FROM_LOOP else_suite COME_FROM_LOOP

View File

@@ -67,7 +67,7 @@ def customize_for_version36(self, version):
"%|async for %c in %c:\n%+%c%-%|else:\n%+%c%-\n\n", "%|async for %c in %c:\n%+%c%-%|else:\n%+%c%-\n\n",
(9, "store"), (9, "store"),
(1, "expr"), (1, "expr"),
(-9, "for_block"), (-10, "for_block"),
(-2, "else_suite"), (-2, "else_suite"),
), ),
"call_ex": ("%c(%p)", (0, "expr"), (1, 100)), "call_ex": ("%c(%p)", (0, "expr"), (1, 100)),