bpo-33041: Fixed bytecode generation for "async for" with a complex target. (#6052)

A StopAsyncIteration raised on assigning or unpacking will be now propagated
instead of stopping the iteration.
This commit is contained in:
Serhiy Storchaka 2018-03-10 18:22:34 +02:00 committed by GitHub
parent 5e80a71ab6
commit 24d3201eb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 2 deletions

View file

@ -2473,8 +2473,8 @@ compiler_async_for(struct compiler *c, stmt_ty s)
ADDOP(c, GET_ANEXT);
ADDOP_O(c, LOAD_CONST, Py_None, consts);
ADDOP(c, YIELD_FROM);
VISIT(c, expr, s->v.AsyncFor.target);
ADDOP(c, POP_BLOCK); /* for SETUP_FINALLY */
VISIT(c, expr, s->v.AsyncFor.target);
compiler_pop_fblock(c, EXCEPT, try);
ADDOP_JREL(c, JUMP_FORWARD, after_try);
@ -4060,8 +4060,8 @@ compiler_async_comprehension_generator(struct compiler *c,
ADDOP(c, GET_ANEXT);
ADDOP_O(c, LOAD_CONST, Py_None, consts);
ADDOP(c, YIELD_FROM);
VISIT(c, expr, gen->target);
ADDOP(c, POP_BLOCK);
VISIT(c, expr, gen->target);
compiler_pop_fblock(c, EXCEPT, try);
ADDOP_JREL(c, JUMP_FORWARD, after_try);