mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-17 01:51:39 +09:00
Make memoryview.__hash__() returns hash value of wrapped object
This commit is contained in:
@@ -34,6 +34,11 @@ impl PyMemoryView {
|
||||
self.obj_ref.clone()
|
||||
}
|
||||
|
||||
#[pymethod(name = "__hash__")]
|
||||
fn hash(&self, vm: &VirtualMachine) -> PyResult {
|
||||
vm.call_method(&self.obj_ref, "__hash__", vec![])
|
||||
}
|
||||
|
||||
#[pymethod(name = "__getitem__")]
|
||||
fn getitem(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult {
|
||||
vm.call_method(&self.obj_ref, "__getitem__", vec![needle])
|
||||
|
||||
Reference in New Issue
Block a user