(
zelf: &Py<Self>,
vm: &VirtualMachine,
)
| 1148 | |
| 1149 | #[pymethod] |
| 1150 | fn __reduce__( |
| 1151 | zelf: &Py<Self>, |
| 1152 | vm: &VirtualMachine, |
| 1153 | ) -> PyResult<(PyObjectRef, PyTupleRef, Option<PyDictRef>)> { |
| 1154 | let array = zelf.read(); |
| 1155 | let cls = zelf.class().to_owned(); |
| 1156 | let typecode = vm.ctx.new_str(array.typecode_str()); |
| 1157 | let values = if array.typecode() == 'u' { |
| 1158 | let s = Self::_wchar_bytes_to_string(array.get_bytes(), array.itemsize(), vm)?; |
| 1159 | s.code_points().map(|x| x.to_pyobject(vm)).collect() |
| 1160 | } else { |
| 1161 | array.get_objects(vm) |
| 1162 | }; |
| 1163 | let values = vm.ctx.new_list(values); |
| 1164 | Ok(( |
| 1165 | cls.into(), |
| 1166 | vm.new_tuple((typecode, values)), |
| 1167 | zelf.as_object().dict(), |
| 1168 | )) |
| 1169 | } |
| 1170 | |
| 1171 | fn __contains__(&self, value: PyObjectRef, vm: &VirtualMachine) -> bool { |
| 1172 | let array = self.array.read(); |
nothing calls this directly
no test coverage detected