summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-01-13 11:43:40 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2012-01-13 11:43:40 (GMT)
commit1f7ce62bd61488d5d721896a36a1b43befab88b5 (patch)
treee7c92d4429ce431c78d0b7816c93862629590223 /Python/compile.c
parente51757f6de9db71b7ee0a6cbf7dde62e9f146804 (diff)
downloadcpython-1f7ce62bd61488d5d721896a36a1b43befab88b5.zip
cpython-1f7ce62bd61488d5d721896a36a1b43befab88b5.tar.gz
cpython-1f7ce62bd61488d5d721896a36a1b43befab88b5.tar.bz2
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 849f487..4d91f50 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);