mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
97e3f0060c
commit
d5a65a77cf
3 changed files with 14 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue