File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -486,8 +486,8 @@ pub trait Hashable: PyValue {
486
486
487
487
#[ inline]
488
488
#[ pymethod]
489
- fn __hash__ ( zelf : PyRef < Self > , vm : & VirtualMachine ) -> PyResult < PyHash > {
490
- Self :: hash ( & zelf, vm)
489
+ fn __hash__ ( zelf : PyObjectRef , vm : & VirtualMachine ) -> PyResult < PyHash > {
490
+ Self :: slot_hash ( & zelf, vm)
491
491
}
492
492
493
493
fn hash ( zelf : & PyRef < Self > , vm : & VirtualMachine ) -> PyResult < PyHash > ;
@@ -499,8 +499,11 @@ impl<T> Hashable for T
499
499
where
500
500
T : Unhashable ,
501
501
{
502
- fn hash ( _zelf : & PyRef < Self > , vm : & VirtualMachine ) -> PyResult < PyHash > {
503
- Err ( vm. new_type_error ( format ! ( "unhashable type: '{}'" , _zelf. class( ) . name( ) ) ) )
502
+ fn slot_hash ( zelf : & PyObjectRef , vm : & VirtualMachine ) -> PyResult < PyHash > {
503
+ Err ( vm. new_type_error ( format ! ( "unhashable type: '{}'" , zelf. class( ) . name( ) ) ) )
504
+ }
505
+ fn hash ( _zelf : & PyRef < Self > , _vm : & VirtualMachine ) -> PyResult < PyHash > {
506
+ unreachable ! ( "slot_hash is implemented for unhashable types" ) ;
504
507
}
505
508
}
506
509
You can’t perform that action at this time.
0 commit comments