summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2003-02-23 23:11:41 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2003-02-23 23:11:41 (GMT)
commitd5a65a77cfdd81ad6945195c88e367fcd9f709c2 (patch)
treeada89cc09c6e26fe8cc9f402840c738cc185bcd7 /Lib/test
parent97e3f0060c2607ca784a1895e7eb01cda5751eb6 (diff)
downloadcpython-d5a65a77cfdd81ad6945195c88e367fcd9f709c2.zip
cpython-d5a65a77cfdd81ad6945195c88e367fcd9f709c2.tar.gz
cpython-d5a65a77cfdd81ad6945195c88e367fcd9f709c2.tar.bz2
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.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_types.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 449d0dd..d571a02 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -639,6 +639,14 @@ try: d.pop(k)
except KeyError: pass
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:
for i in d: