[Python-checkins] python/dist/src/Lib/test test_types.py,1.45,1.46

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
Sun, 23 Feb 2003 15:11:43 -0800


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

Modified Files:
	test_types.py 
Log Message:
Fix SF bug #689659, 64-bit int and long hash keys incompatible

On a 64-bit machine, a dictionary could contain duplicate int/long keys
if the value was > 2**32.


Index: test_types.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** test_types.py	7 Dec 2002 09:04:29 -0000	1.45
--- test_types.py	23 Feb 2003 23:11:41 -0000	1.46
***************
*** 640,643 ****
--- 640,651 ----
  else: raise TestFailed, "{}.pop(k) doesn't raise KeyError when dictionary is empty"
  
+ # verify longs/ints get same value when key > 32 bits (for 64-bit archs)
+ # see SF bug #689659
+ x = 4503599627370496L
+ y = 4503599627370496
+ h = {x: 'anything', y: 'something else'} 
+ if h[x] != h[y]:
+     raise TestFailed, "long/int key should match"
+ 
  d[1] = 1
  try: