Mercurial > cpython-lru_cache-weakref
diff Python/Python-ast.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 | 85cccc38d01c |
| children | f2d557484906 03f92a9f0875 |
line wrap: on
line diff
--- a/Python/Python-ast.c Sat Nov 24 20:41:34 2012 +0100 +++ b/Python/Python-ast.c Sun Nov 25 14:36:26 2012 +0000 @@ -1802,6 +1802,11 @@ 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 @@ 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;
