diff --git a/test/bytecode_3.6/03_async_from_coroutine.pyc b/test/bytecode_3.6/03_async_from_coroutine.pyc new file mode 100644 index 00000000..437a659b Binary files /dev/null and b/test/bytecode_3.6/03_async_from_coroutine.pyc differ diff --git a/test/simple_source/bug36/03_async_from_coroutine.py b/test/simple_source/bug36/03_async_from_coroutine.py new file mode 100644 index 00000000..6afdfe4c --- /dev/null +++ b/test/simple_source/bug36/03_async_from_coroutine.py @@ -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() diff --git a/uncompyle6/parsers/parse36.py b/uncompyle6/parsers/parse36.py index 7581c5ff..a72dbc5e 100644 --- a/uncompyle6/parsers/parse36.py +++ b/uncompyle6/parsers/parse36.py @@ -135,7 +135,7 @@ class Python36Parser(Python35Parser): POP_BLOCK JUMP_FORWARD COME_FROM_EXCEPT DUP_TOP LOAD_GLOBAL COMPARE_OP POP_JUMP_IF_TRUE END_FINALLY COME_FROM - for_block + for_block _come_froms POP_TOP POP_TOP POP_TOP POP_EXCEPT POP_TOP POP_BLOCK else_suite COME_FROM_LOOP diff --git a/uncompyle6/semantics/customize36.py b/uncompyle6/semantics/customize36.py index 84ddc41c..8eeabe2c 100644 --- a/uncompyle6/semantics/customize36.py +++ b/uncompyle6/semantics/customize36.py @@ -67,7 +67,7 @@ def customize_for_version36(self, version): "%|async for %c in %c:\n%+%c%-%|else:\n%+%c%-\n\n", (9, "store"), (1, "expr"), - (-9, "for_block"), + (-10, "for_block"), (-2, "else_suite"), ), "call_ex": ("%c(%p)", (0, "expr"), (1, 100)),