File tree 4 files changed +14
-4
lines changed
4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -1631,8 +1631,6 @@ def test_empty_format_specifier(self):
1631
1631
self .assertEqual (f"{ x !s:} " , "test" )
1632
1632
self .assertEqual (f"{ x !r:} " , "'test'" )
1633
1633
1634
- # TODO: RUSTPYTHON d[0] error
1635
- @unittest .expectedFailure
1636
1634
def test_str_format_differences (self ):
1637
1635
d = {
1638
1636
"a" : "string" ,
Original file line number Diff line number Diff line change @@ -139,6 +139,11 @@ pub fn hash_bigint(value: &BigInt) -> PyHash {
139
139
fix_sentinel ( ret)
140
140
}
141
141
142
+ #[ inline]
143
+ pub fn hash_usize ( data : usize ) -> PyHash {
144
+ fix_sentinel ( mod_int ( data as i64 ) )
145
+ }
146
+
142
147
#[ inline( always) ]
143
148
pub fn fix_sentinel ( x : PyHash ) -> PyHash {
144
149
if x == SENTINEL { -2 } else { x }
Original file line number Diff line number Diff line change @@ -24,3 +24,10 @@ class MyObject:
24
24
assert not hasattr (obj , 'a' )
25
25
obj .__dict__ = {'a' : 1 }
26
26
assert obj .a == 1
27
+
28
+ # Value inside the formatter goes through a different path of resolution.
29
+ # Check that it still works all the same
30
+ d = {
31
+ 0 : "ab" ,
32
+ }
33
+ assert "ab ab" == "{k[0]} {vv}" .format (k = d , vv = d [0 ])
Original file line number Diff line number Diff line change @@ -993,8 +993,8 @@ impl DictKey for usize {
993
993
* self
994
994
}
995
995
996
- fn key_hash ( & self , vm : & VirtualMachine ) -> PyResult < HashValue > {
997
- Ok ( vm . state . hash_secret . hash_value ( self ) )
996
+ fn key_hash ( & self , _vm : & VirtualMachine ) -> PyResult < HashValue > {
997
+ Ok ( hash :: hash_usize ( * self ) )
998
998
}
999
999
1000
1000
fn key_is ( & self , _other : & PyObject ) -> bool {
You can’t perform that action at this time.
0 commit comments