Skip to content

Commit

Permalink
Merge d009209 into 27767aa
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanhogg committed Jul 22, 2020
2 parents 27767aa + d009209 commit d46a270
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
3 changes: 2 additions & 1 deletion py/compile.c
Expand Up @@ -1798,7 +1798,8 @@ STATIC void compile_async_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns
uint try_finally_label = comp_next_label(comp);

compile_node(comp, pns->nodes[1]); // iterator
compile_await_object_method(comp, MP_QSTR___aiter__);
EMIT_ARG(load_method, MP_QSTR___aiter__, false);
EMIT_ARG(call_method, 0, 0, 0);
compile_store_id(comp, context);

START_BREAK_CONTINUE_BLOCK
Expand Down
2 changes: 1 addition & 1 deletion tests/basics/async_for.py
Expand Up @@ -6,7 +6,7 @@ def __init__(self, obj):
print('init')
self._it = iter(obj)

async def __aiter__(self):
def __aiter__(self):
print('aiter')
return self

Expand Down
3 changes: 1 addition & 2 deletions tests/basics/async_for2.py
Expand Up @@ -21,9 +21,8 @@ def __init__(self, high):
self.cur = 0
self.high = high

async def __aiter__(self):
def __aiter__(self):
print('aiter')
print('f returned:', await f(10))
return self

async def __anext__(self):
Expand Down
4 changes: 0 additions & 4 deletions tests/basics/async_for2.py.exp
@@ -1,9 +1,5 @@
init
aiter
f start: 10
coro yielded: 11
coro yielded: 12
f returned: 13
anext
f start: 20
coro yielded: 21
Expand Down

0 comments on commit d46a270

Please sign in to comment.