(
zelf: &Py<Self>,
proto: usize,
vm: &VirtualMachine,
)
| 1124 | |
| 1125 | #[pymethod] |
| 1126 | fn __reduce_ex__( |
| 1127 | zelf: &Py<Self>, |
| 1128 | proto: usize, |
| 1129 | vm: &VirtualMachine, |
| 1130 | ) -> PyResult<(PyObjectRef, PyTupleRef, Option<PyDictRef>)> { |
| 1131 | if proto < 3 { |
| 1132 | return Self::__reduce__(zelf, vm); |
| 1133 | } |
| 1134 | let array = zelf.read(); |
| 1135 | let cls = zelf.class().to_owned(); |
| 1136 | let typecode = vm.ctx.new_str(array.typecode_str()); |
| 1137 | let bytes = vm.ctx.new_bytes(array.get_bytes().to_vec()); |
| 1138 | let code = MachineFormatCode::from_typecode(array.typecode()).unwrap(); |
| 1139 | let code = PyInt::from(u8::from(code)).into_pyobject(vm); |
| 1140 | let module = vm.import("array", 0)?; |
| 1141 | let func = module.get_attr("_array_reconstructor", vm)?; |
| 1142 | Ok(( |
| 1143 | func, |
| 1144 | vm.new_tuple((cls, typecode, code, bytes)), |
| 1145 | zelf.as_object().dict(), |
| 1146 | )) |
| 1147 | } |
| 1148 | |
| 1149 | #[pymethod] |
| 1150 | fn __reduce__( |
nothing calls this directly
no test coverage detected