bpo-36332: Allow compile() to handle AST objects with assignment expressions (GH-12398)

This commit is contained in:
Pablo Galindo 2019-03-18 13:51:53 +00:00 committed by GitHub
parent 2ddc7f6d62
commit 0c9258a6d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View file

@ -316,13 +316,14 @@ validate_expr(expr_ty exp, expr_context_ty ctx)
return validate_exprs(exp->v.List.elts, ctx, 0);
case Tuple_kind:
return validate_exprs(exp->v.Tuple.elts, ctx, 0);
case NamedExpr_kind:
return validate_expr(exp->v.NamedExpr.value, Load);
/* This last case doesn't have any checking. */
case Name_kind:
return 1;
default:
PyErr_SetString(PyExc_SystemError, "unexpected expression");
return 0;
}
PyErr_SetString(PyExc_SystemError, "unexpected expression");
return 0;
}
static int