diff --git a/vm/src/protocol/object.rs b/vm/src/protocol/object.rs index 940512d0e..faad41a57 100644 --- a/vm/src/protocol/object.rs +++ b/vm/src/protocol/object.rs @@ -132,7 +132,11 @@ impl PyObjectRef { } pub fn hash(&self, vm: &VirtualMachine) -> PyResult { - vm._hash(self) + let hash = self + .class() + .mro_find_map(|cls| cls.slots.hash.load()) + .unwrap(); // hash always exist + hash(self, vm) } // const hash_not_implemented: fn(&PyObjectRef, &VirtualMachine) ->PyResult = crate::types::Unhashable::slot_hash; diff --git a/vm/src/vm.rs b/vm/src/vm.rs index bb60bd7e0..5caca74d9 100644 --- a/vm/src/vm.rs +++ b/vm/src/vm.rs @@ -1885,14 +1885,6 @@ impl VirtualMachine { self._cmp(&a, &b, op).map(|res| res.into_pyobject(self)) } - pub fn _hash(&self, obj: &PyObjectRef) -> PyResult { - let hash = obj - .class() - .mro_find_map(|cls| cls.slots.hash.load()) - .unwrap(); // hash always exist - hash(obj, self) - } - pub fn obj_len_opt(&self, obj: &PyObjectRef) -> Option> { self.get_special_method(obj.clone(), "__len__") .map(Result::ok)