You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Fix More 3.6 async parsing
... all from 3.6 test_coroutines.py. More bugs remain
This commit is contained in:
BIN
test/bytecode_3.6/03_async_from_coroutine.pyc
Normal file
BIN
test/bytecode_3.6/03_async_from_coroutine.pyc
Normal file
Binary file not shown.
39
test/simple_source/bug36/03_async_from_coroutine.py
Normal file
39
test/simple_source/bug36/03_async_from_coroutine.py
Normal 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()
|
@@ -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
|
||||||
|
@@ -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)),
|
||||||
|
Reference in New Issue
Block a user