diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-02-26 20:51:25 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-02-26 20:51:25 (GMT) |
commit | ce1d5d2527810961f7fe8f7a64d9e54075da482e (patch) | |
tree | 2d5b7e63cef263265d17bf9163d8ca58751ad45b /Python/Python-ast.c | |
parent | bd260da900b5c5f16e5c61f6795d08171b33e0f8 (diff) | |
download | cpython-ce1d5d2527810961f7fe8f7a64d9e54075da482e.zip cpython-ce1d5d2527810961f7fe8f7a64d9e54075da482e.tar.gz cpython-ce1d5d2527810961f7fe8f7a64d9e54075da482e.tar.bz2 |
Fix iterating over cmpop_ty lists.
Diffstat (limited to 'Python/Python-ast.c')
-rw-r--r-- | Python/Python-ast.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c index f881c47..ee6a538 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -2216,8 +2216,13 @@ ast2obj_expr(void* _o) if (PyObject_SetAttrString(result, "left", value) == -1) goto failed; Py_DECREF(value); - value = ast2obj_list(o->v.Compare.ops, - (PyObject*(*)(void*))ast2obj_cmpop); + { + int i, n = asdl_seq_LEN(o->v.Compare.ops); + value = PyList_New(n); + if (!value) goto failed; + for(i = 0; i < n; i++) + PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i))); + } if (!value) goto failed; if (PyObject_SetAttrString(result, "ops", value) == -1) goto failed; |