[Python-checkins] python/dist/src/Python compile.c,2.274,2.275

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Wed, 12 Feb 2003 08:57:10 -0800


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

Modified Files:
	compile.c 
Log Message:
SF #660455 : patch by NNorwitz.

"Unsigned" (i.e., positive-looking, but really negative) hex/oct
constants with a leading minus sign are once again properly negated.
The micro-optimization for negated numeric constants did the wrong
thing for such hex/oct constants.  The patch avoids the optimization
for all hex/oct constants.

This needs to be backported to Python 2.2!


Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.274
retrieving revision 2.275
diff -C2 -d -r2.274 -r2.275
*** compile.c	10 Feb 2003 08:21:10 -0000	2.274
--- compile.c	12 Feb 2003 16:56:51 -0000	2.275
***************
*** 2070,2074 ****
  	    && TYPE((patom = CHILD(ppower, 0))) == atom
  	    && TYPE((pnum = CHILD(patom, 0))) == NUMBER
! 	    && !(childtype == MINUS && is_float_zero(STR(pnum)))) {
  		if (childtype == TILDE) {
  			com_invert_constant(c, pnum);
--- 2070,2075 ----
  	    && TYPE((patom = CHILD(ppower, 0))) == atom
  	    && TYPE((pnum = CHILD(patom, 0))) == NUMBER
! 	    && !(childtype == MINUS &&
! 		 (STR(pnum)[0] == '0' || is_float_zero(STR(pnum))))) {
  		if (childtype == TILDE) {
  			com_invert_constant(c, pnum);