[Python-checkins] CVS: python/dist/src/Python compile.c,2.220,2.221

Fred L. Drake fdrake@users.sourceforge.net
Thu, 30 Aug 2001 11:53:30 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv7596

Modified Files:
	compile.c 
Log Message:
When re-writing a factor containing a unary negation of a literal, only
affect nodes without another operator.  This was causing negated
exponentiations to drop the exponentiation.  This closes SF bug #456756.


Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.220
retrieving revision 2.221
diff -C2 -d -r2.220 -r2.221
*** compile.c	2001/08/30 14:06:45	2.220
--- compile.c	2001/08/30 18:53:25	2.221
***************
*** 1892,1897 ****
--- 1892,1900 ----
  	 */
  	if ((childtype == PLUS || childtype == MINUS || childtype == TILDE)
+ 	    && NCH(n) == 2
  	    && TYPE(CHILD(n, 1)) == factor
+  	    && NCH(CHILD(n, 1)) == 1
  	    && TYPE(CHILD(CHILD(n, 1), 0)) == power
+  	    && NCH(CHILD(CHILD(n, 1), 0)) == 1
  	    && TYPE(CHILD(CHILD(CHILD(n, 1), 0), 0)) == atom
  	    && TYPE(CHILD(CHILD(CHILD(CHILD(n, 1), 0), 0), 0)) == NUMBER) {