diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-02-26 20:51:25 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-02-26 20:51:25 +0000 |
commit | 7e0dc7ed8183c5679e6774c742980201aea9449f (patch) | |
tree | 0370e85d144e56ee08a12650561393dc26cc17dc /Python/Python-ast.c | |
parent | 7ea809c12fdbd57b820f4c63ed5969552d20b3d2 (diff) | |
download | cpython-7e0dc7ed8183c5679e6774c742980201aea9449f.tar.gz |
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 f881c474ba..ee6a5380f4 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; |