summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-01-13 21:43:40 +1000
committerNick Coghlan <ncoghlan@gmail.com>2012-01-13 21:43:40 +1000
commite4f5fc423651e760f014159dce83273f9d54831c (patch)
treee360ee4d0537af068dfc72bd23a8f10923df95af /Python/compile.c
parentc1e6291fd19c26493558363fb75d5395cd05511b (diff)
downloadcpython-e4f5fc423651e760f014159dce83273f9d54831c.tar.gz
Implement PEP 380 - 'yield from' (closes #11682)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 849f48785d..4d91f5024b 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -840,6 +840,7 @@ opcode_stack_effect(int opcode, int oparg)
case IMPORT_STAR:
return -1;
case YIELD_VALUE:
+ case YIELD_FROM:
return 0;
case POP_BLOCK:
@@ -3318,7 +3319,12 @@ compiler_visit_expr(struct compiler *c, expr_ty e)
else {
ADDOP_O(c, LOAD_CONST, Py_None, consts);
}
- ADDOP(c, YIELD_VALUE);
+ if (e->v.Yield.is_from) {
+ ADDOP(c, YIELD_FROM);
+ }
+ else {
+ ADDOP(c, YIELD_VALUE);
+ }
break;
case Compare_kind:
return compiler_compare(c, e);