Mercurial > cpython-lru_cache-weakref
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 80586:c9d205e2dd02 | 80589:ffb2fa900cb7 |
|---|---|
| 1800 | 1800 |
| 1801 expr_ty | 1801 expr_ty |
| 1802 YieldFrom(expr_ty value, int lineno, int col_offset, PyArena *arena) | 1802 YieldFrom(expr_ty value, int lineno, int col_offset, PyArena *arena) |
| 1803 { | 1803 { |
| 1804 expr_ty p; | 1804 expr_ty p; |
| 1805 if (!value) { | |
| 1806 PyErr_SetString(PyExc_ValueError, | |
| 1807 "field value is required for YieldFrom"); | |
| 1808 return NULL; | |
| 1809 } | |
| 1805 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); | 1810 p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); |
| 1806 if (!p) | 1811 if (!p) |
| 1807 return NULL; | 1812 return NULL; |
| 1808 p->kind = YieldFrom_kind; | 1813 p->kind = YieldFrom_kind; |
| 1809 p->v.YieldFrom.value = value; | 1814 p->v.YieldFrom.value = value; |
| 5429 res = obj2ast_expr(tmp, &value, arena); | 5434 res = obj2ast_expr(tmp, &value, arena); |
| 5430 if (res != 0) goto failed; | 5435 if (res != 0) goto failed; |
| 5431 Py_XDECREF(tmp); | 5436 Py_XDECREF(tmp); |
| 5432 tmp = NULL; | 5437 tmp = NULL; |
| 5433 } else { | 5438 } else { |
| 5434 value = NULL; | 5439 PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from YieldFrom"); |
| 5440 return 1; | |
| 5435 } | 5441 } |
| 5436 *out = YieldFrom(value, lineno, col_offset, arena); | 5442 *out = YieldFrom(value, lineno, col_offset, arena); |
| 5437 if (*out == NULL) goto failed; | 5443 if (*out == NULL) goto failed; |
| 5438 return 0; | 5444 return 0; |
| 5439 } | 5445 } |
