Mercurial > cpython-lru_cache-weakref
comparison Python/Python-ast.c @ 37685:5e72b0c74100 legacy-trunk
Introduce asdl_int_seq, to hold cmpop_ty.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Thu, 13 Apr 2006 12:29:43 +0000 |
| parents | f76b5d987314 |
| children | 29d65741f6c8 |
comparison
equal
deleted
inserted
replaced
| 37684:399b119c058a | 37685:5e72b0c74100 |
|---|---|
| 1501 p->col_offset = col_offset; | 1501 p->col_offset = col_offset; |
| 1502 return p; | 1502 return p; |
| 1503 } | 1503 } |
| 1504 | 1504 |
| 1505 expr_ty | 1505 expr_ty |
| 1506 Compare(expr_ty left, asdl_seq * ops, asdl_seq * comparators, int lineno, int | 1506 Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno, |
| 1507 col_offset, PyArena *arena) | 1507 int col_offset, PyArena *arena) |
| 1508 { | 1508 { |
| 1509 expr_ty p; | 1509 expr_ty p; |
| 1510 if (!left) { | 1510 if (!left) { |
| 1511 PyErr_SetString(PyExc_ValueError, | 1511 PyErr_SetString(PyExc_ValueError, |
| 1512 "field left is required for Compare"); | 1512 "field left is required for Compare"); |
| 2501 { | 2501 { |
| 2502 int i, n = asdl_seq_LEN(o->v.Compare.ops); | 2502 int i, n = asdl_seq_LEN(o->v.Compare.ops); |
| 2503 value = PyList_New(n); | 2503 value = PyList_New(n); |
| 2504 if (!value) goto failed; | 2504 if (!value) goto failed; |
| 2505 for(i = 0; i < n; i++) | 2505 for(i = 0; i < n; i++) |
| 2506 PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)(int)asdl_seq_GET(o->v.Compare.ops, i))); | 2506 PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i))); |
| 2507 } | 2507 } |
| 2508 if (!value) goto failed; | 2508 if (!value) goto failed; |
| 2509 if (PyObject_SetAttrString(result, "ops", value) == -1) | 2509 if (PyObject_SetAttrString(result, "ops", value) == -1) |
| 2510 goto failed; | 2510 goto failed; |
| 2511 Py_DECREF(value); | 2511 Py_DECREF(value); |
