summaryrefslogtreecommitdiffstats
path: root/Python/Python-ast.c
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-11-25 14:36:26 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2012-11-25 14:36:26 (GMT)
commitded35aeb9d5ae1671174f10c0ae8a7166693b17c (patch)
tree4caa61589581de32b38d3da8ee8bd68e553094bf /Python/Python-ast.c
parent9982c53c2feb6e6e03c4c6d87d77c6ee69bfc435 (diff)
downloadcpython-ded35aeb9d5ae1671174f10c0ae8a7166693b17c.zip
cpython-ded35aeb9d5ae1671174f10c0ae8a7166693b17c.tar.gz
cpython-ded35aeb9d5ae1671174f10c0ae8a7166693b17c.tar.bz2
Issue #16546: make ast.YieldFrom argument mandatory.
Diffstat (limited to 'Python/Python-ast.c')
-rw-r--r--Python/Python-ast.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 805f2b8..e6f1e58 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -1802,6 +1802,11 @@ expr_ty
YieldFrom(expr_ty value, int lineno, int col_offset, PyArena *arena)
{
expr_ty p;
+ if (!value) {
+ PyErr_SetString(PyExc_ValueError,
+ "field value is required for YieldFrom");
+ return NULL;
+ }
p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
if (!p)
return NULL;
@@ -5431,7 +5436,8 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
Py_XDECREF(tmp);
tmp = NULL;
} else {
- value = NULL;
+ PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from YieldFrom");
+ return 1;
}
*out = YieldFrom(value, lineno, col_offset, arena);
if (*out == NULL) goto failed;