diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-01-14 08:58:23 -0500 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-01-14 08:58:23 -0500 |
commit | 37fe2bd5e9be127591b1e39efe50fc0c3348b5ab (patch) | |
tree | a6a2ba3887515ebb84accb6844eee6db1d661be3 /Python/compile.c | |
parent | 111b4f56ca0c8da36d313a0563674c2f82e68d3e (diff) | |
download | cpython-37fe2bd5e9be127591b1e39efe50fc0c3348b5ab.tar.gz |
make YieldFrom its own distinct from Yield (closes #13780)
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c index 4d91f5024b..b64c800e19 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3311,21 +3311,25 @@ compiler_visit_expr(struct compiler *c, expr_ty e) case DictComp_kind: return compiler_dictcomp(c, e); case Yield_kind: + case YieldFrom_kind: { + expr_ty value; if (c->u->u_ste->ste_type != FunctionBlock) return compiler_error(c, "'yield' outside function"); - if (e->v.Yield.value) { - VISIT(c, expr, e->v.Yield.value); + value = (e->kind == YieldFrom_kind) ? e->v.YieldFrom.value : e->v.Yield.value; + if (value) { + VISIT(c, expr, value); } else { ADDOP_O(c, LOAD_CONST, Py_None, consts); } - if (e->v.Yield.is_from) { + if (e->kind == YieldFrom_kind) { ADDOP(c, YIELD_FROM); } else { ADDOP(c, YIELD_VALUE); } break; + } case Compare_kind: return compiler_compare(c, e); case Call_kind: |