Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 80589:ffb2fa900cb7 3.3
Issue #16546: make ast.YieldFrom argument mandatory.
| author | Mark Dickinson <mdickinson@enthought.com> |
|---|---|
| date | Sun, 25 Nov 2012 14:36:26 +0000 |
| parents | ab02cd145f56 |
| children | 72f0fd0c4d90 03f92a9f0875 |
line wrap: on
line diff
--- a/Python/compile.c Sat Nov 24 20:41:34 2012 +0100 +++ b/Python/compile.c Sun Nov 25 14:36:26 2012 +0000 @@ -3341,27 +3341,24 @@ 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"); - value = (e->kind == YieldFrom_kind) ? e->v.YieldFrom.value : e->v.Yield.value; - if (value) { - VISIT(c, expr, value); + if (e->v.Yield.value) { + VISIT(c, expr, e->v.Yield.value); } else { ADDOP_O(c, LOAD_CONST, Py_None, consts); } - if (e->kind == YieldFrom_kind) { - ADDOP(c, GET_ITER); - ADDOP_O(c, LOAD_CONST, Py_None, consts); - ADDOP(c, YIELD_FROM); - } - else { - ADDOP(c, YIELD_VALUE); - } + ADDOP(c, YIELD_VALUE); break; - } + case YieldFrom_kind: + if (c->u->u_ste->ste_type != FunctionBlock) + return compiler_error(c, "'yield' outside function"); + VISIT(c, expr, e->v.YieldFrom.value); + ADDOP(c, GET_ITER); + ADDOP_O(c, LOAD_CONST, Py_None, consts); + ADDOP(c, YIELD_FROM); + break; case Compare_kind: return compiler_compare(c, e); case Call_kind:
