MCPcopy Index your code
hub / github.com/RustPython/RustPython / __reduce__

Method __reduce__

crates/vm/src/builtins/zip.rs:50–63  ·  view source on GitHub ↗
(zelf: PyRef<Self>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

48impl PyZip {
49 #[pymethod]
50 fn __reduce__(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<PyTupleRef> {
51 let cls = zelf.class().to_owned();
52 let iterators = zelf
53 .iterators
54 .iter()
55 .map(|obj| obj.clone().into())
56 .collect::<Vec<_>>();
57 let tuple_iter = vm.ctx.new_tuple(iterators);
58 Ok(if zelf.strict.load(atomic::Ordering::Acquire) {
59 vm.new_tuple((cls, tuple_iter, true))
60 } else {
61 vm.new_tuple((cls, tuple_iter))
62 })
63 }
64
65 #[pymethod]
66 fn __setstate__(zelf: PyRef<Self>, state: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {

Callers

nothing calls this directly

Calls 7

to_ownedMethod · 0.45
classMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
cloneMethod · 0.45
new_tupleMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected