(zelf: &Py<Self>, vm: &VirtualMachine)
| 1095 | |
| 1096 | impl Hashable for PyMemoryView { |
| 1097 | fn hash(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyHash> { |
| 1098 | if let Some(val) = zelf.hash.get() { |
| 1099 | return Ok(*val); |
| 1100 | } |
| 1101 | zelf.try_not_released(vm)?; |
| 1102 | if !zelf.desc.readonly { |
| 1103 | return Err(vm.new_value_error("cannot hash writable memoryview object")); |
| 1104 | } |
| 1105 | let val = zelf.contiguous_or_collect(|bytes| vm.state.hash_secret.hash_bytes(bytes)); |
| 1106 | let _ = zelf.hash.set(val); |
| 1107 | Ok(*zelf.hash.get().unwrap()) |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | impl PyPayload for PyMemoryView { |
nothing calls this directly
no test coverage detected