Skip to content

Commit e7eab05

Browse files
committed
Fix problems with different hash values for str and bytes
1 parent 7d75c4e commit e7eab05

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

Lib/test/test_builtin.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,6 @@ def __getattr__(self, what):
691691
raise ValueError
692692
self.assertRaises(ValueError, hasattr, B(), "b")
693693

694-
# TODO: RUSTPYTHON
695-
@unittest.expectedFailure
696694
def test_hash(self):
697695
hash(None)
698696
self.assertEqual(hash(1), hash(1))

common/src/hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,5 @@ pub fn hash_bigint(value: &BigInt) -> PyHash {
118118
}
119119

120120
pub fn hash_str(value: &str) -> PyHash {
121-
hash_value(value)
121+
hash_value(value.as_bytes())
122122
}

0 commit comments

Comments
 (0)