Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1de1394 commit 37bfa4eCopy full SHA for 37bfa4e
1 file changed
Lib/test/test_hash.py
@@ -45,6 +45,16 @@ def test_coerced_floats(self):
45
self.same_hash(int(1.23e300), float(1.23e300))
46
self.same_hash(float(0.5), complex(0.5, 0.0))
47
48
+ def test_unaligned_buffers(self):
49
+ # The hash function for bytes-like objects shouldn't have
50
+ # alignment-dependent results (example in issue #16427).
51
+ b = b"123456789abcdefghijklmnopqrstuvwxyz" * 128
52
+ for i in range(16):
53
+ for j in range(16):
54
+ aligned = b[i:128+j]
55
+ unaligned = memoryview(b)[i:128+j]
56
+ self.assertEqual(hash(aligned), hash(unaligned))
57
+
58
59
_default_hash = object.__hash__
60
class DefaultHash(object): pass
0 commit comments