[Python-checkins] python/dist/src/Lib/test test_grammar.py,1.44,1.45

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


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv6400

Modified Files:
	test_grammar.py 
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: test_grammar.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** test_grammar.py	29 Aug 2002 14:57:26 -0000	1.44
--- test_grammar.py	12 Feb 2003 16:57:31 -0000	1.45
***************
*** 38,42 ****
      maxint = 2147483647
  if maxint == 2147483647:
!     if -2147483647-1 != -020000000000: raise TestFailed, 'max negative int'
      # XXX -2147483648
      if 037777777777 != -1: raise TestFailed, 'oct -1'
--- 38,44 ----
      maxint = 2147483647
  if maxint == 2147483647:
!     # The following test will start to fail in Python 2.4;
!     # change the 020000000000 to -020000000000
!     if -2147483647-1 != 020000000000: raise TestFailed, 'max negative int'
      # XXX -2147483648
      if 037777777777 != -1: raise TestFailed, 'oct -1'