[Python-checkins] CVS: python/dist/src/Lib/test test_b1.py,1.34,1.34.4.1

Thomas Wouters twouters@users.sourceforge.net
Wed, 27 Jun 2001 07:27:00 -0700


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

Modified Files:
      Tag: release21-maint
	test_b1.py 
Log Message:

Backport of Tim's checkin 1.35:

SF bug 434186: 0x80000000/2 != 0x80000000>>1
i_divmod:  New and simpler algorithm.  Old one returned gibberish on most
boxes when the numerator was -sys.maxint-1.  Oddly enough, it worked in the
release (not debug) build on Windows, because the compiler optimized away
some tricky sign manipulations that were incorrect in this case. 
Makes you wonder <wink> ...



Index: test_b1.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v
retrieving revision 1.34
retrieving revision 1.34.4.1
diff -C2 -r1.34 -r1.34.4.1
*** test_b1.py	2001/01/22 19:30:07	1.34
--- test_b1.py	2001/06/27 14:26:58	1.34.4.1
***************
*** 368,371 ****
--- 368,378 ----
      raise TestFailed, "int(%s)" % `s[1:]` + " should raise ValueError"
  
+ # SF bug 434186:  0x80000000/2 != 0x80000000>>1.
+ # Worked by accident in Windows release build, but failed in debug build.
+ # Failed in all Linux builds.
+ x = -1-sys.maxint
+ if x >> 1 != x/2:
+     raise TestFailed("x >> 1 != x/2 when x == -1-sys.maxint")
+ 
  print 'isinstance'
  class C: