diff --git a/vm/src/obj/objdict.rs b/vm/src/obj/objdict.rs index 449c60726..541645d5f 100644 --- a/vm/src/obj/objdict.rs +++ b/vm/src/obj/objdict.rs @@ -206,14 +206,14 @@ impl PyDictRef { fn hash(self, vm: &VirtualMachine) -> PyResult { Err(vm.new_type_error("unhashable type".to_string())) } -} -impl DictProtocol for PyDictRef { - fn contains_key(&self, key: T, vm: &VirtualMachine) -> bool { + pub fn contains_key(&self, key: T, vm: &VirtualMachine) -> bool { let key = key.into_pyobject(vm).unwrap(); self.entries.borrow().contains(vm, &key).unwrap() } +} +impl DictProtocol for PyDictRef { fn get_item(&self, key: T, vm: &VirtualMachine) -> Option { let key = key.into_pyobject(vm).unwrap(); self.entries.borrow().get(vm, &key).ok() diff --git a/vm/src/pyobject.rs b/vm/src/pyobject.rs index 4df7e57fe..bf5cf3c86 100644 --- a/vm/src/pyobject.rs +++ b/vm/src/pyobject.rs @@ -913,7 +913,6 @@ impl TypeProtocol for PyRef { } pub trait DictProtocol { - fn contains_key(&self, key: T, vm: &VirtualMachine) -> bool; fn get_item(&self, key: T, vm: &VirtualMachine) -> Option; fn set_item(&self, key: T, value: PyObjectRef, vm: &VirtualMachine); fn del_item(&self, key: T, vm: &VirtualMachine);