Mercurial > cpython-lru_cache-weakref
diff Python/ast.c @ 74391:e1177b9167ce
make YieldFrom its own distinct from Yield (closes #13780)
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 14 Jan 2012 08:58:23 -0500 |
| parents | d64ac9ab4cd0 |
| children | 0debff8be37e |
line wrap: on
line diff
--- a/Python/ast.c Sat Jan 14 21:08:15 2012 +0800 +++ b/Python/ast.c Sat Jan 14 08:58:23 2012 -0500 @@ -223,6 +223,9 @@ validate_expr(exp->v.DictComp.value, Load); case Yield_kind: return !exp->v.Yield.value || validate_expr(exp->v.Yield.value, Load); + case YieldFrom_kind: + return !exp->v.YieldFrom.value || + validate_expr(exp->v.YieldFrom.value, Load); case Compare_kind: if (!asdl_seq_LEN(exp->v.Compare.comparators)) { PyErr_SetString(PyExc_ValueError, "Compare with no comparators"); @@ -942,6 +945,7 @@ expr_name = "generator expression"; break; case Yield_kind: + case YieldFrom_kind: expr_name = "yield expression"; break; case ListComp_kind: @@ -2386,7 +2390,9 @@ if (!exp) return NULL; } - return Yield(is_from, exp, LINENO(n), n->n_col_offset, c->c_arena); + if (is_from) + return YieldFrom(exp, LINENO(n), n->n_col_offset, c->c_arena); + return Yield(exp, LINENO(n), n->n_col_offset, c->c_arena); } case factor: if (NCH(n) == 1) {
