[Python-checkins] python/dist/src/Python ast.c,1.1.2.35,1.1.2.36

jhylton at users.sourceforge.net jhylton at users.sourceforge.net
Tue Dec 2 01:54:30 EST 2003


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv31586
Modified Files:
 Tag: ast-branch
	ast.c 
Log Message:
Probable fix for set_context().
It was complaining about types that don't have a context attribute,
but I think it's expected to ignore these expression types. My memory
is hazy.
Change comparisons so -1 is second. No way.
Index: ast.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v
retrieving revision 1.1.2.35
retrieving revision 1.1.2.36
diff -C2 -d -r1.1.2.35 -r1.1.2.36
*** ast.c	2 Dec 2003 05:53:43 -0000	1.1.2.35
--- ast.c	2 Dec 2003 06:54:28 -0000	1.1.2.36
***************
*** 278,284 ****
 break;
 default:
! PyErr_Format(PyExc_SyntaxError, "can't set context for %d",
! e->kind);
! return -1;
 }
 if (s) {
--- 278,286 ----
 break;
 default:
! 	 /* XXX It's not clear why were't getting into this code,
! 	 although list comps seem like one possibility.
! 	 */
! 	 fprintf(stderr, "can't set context for %d\n", e->kind);
! return 0;
 }
 if (s) {
***************
*** 327,331 ****
 default:
 PyErr_Format(PyExc_Exception, "invalid augassign: %s", STR(n));
! return NULL;
 }
 }
--- 329,333 ----
 default:
 PyErr_Format(PyExc_Exception, "invalid augassign: %s", STR(n));
! return 0;
 }
 }
***************
*** 362,366 ****
 PyErr_Format(PyExc_Exception, "invalid comp_op: %s",
 STR(n));
! return NULL;
 	}
 }
--- 364,368 ----
 PyErr_Format(PyExc_Exception, "invalid comp_op: %s",
 STR(n));
! return 0;
 	}
 }
***************
*** 376,385 ****
 PyErr_Format(PyExc_Exception, "invalid comp_op: %s %s",
 STR(CHILD(n, 0)), STR(CHILD(n, 1)));
! return NULL;
 	}
 }
 PyErr_Format(PyExc_Exception, "invalid comp_op: has %d children",
 NCH(n));
! return NULL;
 }
 
--- 378,387 ----
 PyErr_Format(PyExc_Exception, "invalid comp_op: %s %s",
 STR(CHILD(n, 0)), STR(CHILD(n, 1)));
! return 0;
 	}
 }
 PyErr_Format(PyExc_Exception, "invalid comp_op: has %d children",
 NCH(n));
! return 0;
 }
 
***************
*** 623,626 ****
--- 625,630 ----
 node *ch;
 
+ fprintf(stderr, "listcomp at %d\n", n->n_lineno);
+ 
 REQ(n, listmaker);
 assert(NCH(n) > 1);
***************
*** 630,638 ****
 return NULL;
 
! if (-1 == set_context(elt, Load))
 return NULL;
 
 n_fors = count_list_fors(n);
! if (-1 == n_fors)
 return NULL;
 
--- 634,644 ----
 return NULL;
 
! if (set_context(elt, Load) == -1) {
! 	fprintf(stderr, "XXX 2\n");
 return NULL;
+ }
 
 n_fors = count_list_fors(n);
! if (n_fors == -1)
 return NULL;
 
***************
*** 678,682 ****
 	 ch = CHILD(ch, 4);
 	 n_ifs = count_list_ifs(ch);
! if (-1 == n_ifs) {
 asdl_seq_free(listcomps);
 return NULL;
--- 684,688 ----
 	 ch = CHILD(ch, 4);
 	 n_ifs = count_list_ifs(ch);
! if (n_ifs == -1) {
 asdl_seq_free(listcomps);
 return NULL;
***************
*** 1295,1299 ****
 	 }
 	 tmp = set_context(e, Store);
! if (-1 == tmp) {
 asdl_seq_free(targets);
 return NULL;
--- 1301,1305 ----
 	 }
 	 tmp = set_context(e, Store);
! if (tmp == -1) {
 asdl_seq_free(targets);
 return NULL;
***************
*** 1360,1364 ****
 	if (context) {
 int context_result = set_context(e, context);
! 	 if (-1 == context_result)
 return NULL;
 }
--- 1366,1370 ----
 	if (context) {
 int context_result = set_context(e, context);
! 	 if (context_result == -1)
 return NULL;
 }
***************
*** 1971,1975 ****
 	if (!e)
 return NULL;
! 	if (-1 == set_context(e, Store))
 return NULL;
 expression = ast_for_expr(CHILD(exc, 1));
--- 1977,1981 ----
 	if (!e)
 return NULL;
! 	if (set_context(e, Store) == -1)
 return NULL;
 expression = ast_for_expr(CHILD(exc, 1));


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /