summaryrefslogtreecommitdiffstats
path: root/Python/ast.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-01-14 13:58:23 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-01-14 13:58:23 (GMT)
commit527c62292675ce6f0528593915900f2d025b0259 (patch)
tree010c85e5dc0b555d1342040b04fadededc3b3984 /Python/ast.c
parent91f252b179c4d399f735fedf72e53148e0b057fc (diff)
downloadcpython-527c62292675ce6f0528593915900f2d025b0259.zip
cpython-527c62292675ce6f0528593915900f2d025b0259.tar.gz
cpython-527c62292675ce6f0528593915900f2d025b0259.tar.bz2
make YieldFrom its own distinct from Yield (closes #13780)
Diffstat (limited to 'Python/ast.c')
-rw-r--r--Python/ast.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 7080c65..3417fe3 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -223,6 +223,9 @@ validate_expr(expr_ty exp, expr_context_ty ctx)
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 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
expr_name = "generator expression";
break;
case Yield_kind:
+ case YieldFrom_kind:
expr_name = "yield expression";
break;
case ListComp_kind:
@@ -2386,7 +2390,9 @@ ast_for_expr(struct compiling *c, const node *n)
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) {