Mailing List Archive

python/dist/src/Python ast.c,1.1.2.7,1.1.2.8
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv5977

Modified Files:
Tag: ast-branch
ast.c
Log Message:
Properly compute size of return sequence for testlist.

If the number of children is oddd e.g. "1 , 2" we must round up.


Index: ast.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** ast.c 30 Sep 2002 18:21:45 -0000 1.1.2.7
--- ast.c 1 Oct 2002 18:31:05 -0000 1.1.2.8
***************
*** 330,337 ****
seq_for_testlist(const node *n)
{
asdl_seq *seq;
int i;

! seq = asdl_seq_new(NCH(n) / 2);
for (i = 0; i < NCH(n); i += 2) {
asdl_seq_SET(seq, i / 2, ast_for_expr(CHILD(n, i)));
--- 330,338 ----
seq_for_testlist(const node *n)
{
+ /* testlist: test (',' test)* [','] */
asdl_seq *seq;
int i;

! seq = asdl_seq_new((NCH(n) + 1) / 2);
for (i = 0; i < NCH(n); i += 2) {
asdl_seq_SET(seq, i / 2, ast_for_expr(CHILD(n, i)));