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

Method __reduce__

crates/vm/src/builtins/range.rs:314–321  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

312
313 #[pymethod]
314 fn __reduce__(&self, vm: &VirtualMachine) -> (PyTypeRef, PyTupleRef) {
315 let range_parameters: Vec<PyObjectRef> = [&self.start, &self.stop, &self.step]
316 .iter()
317 .map(|x| x.as_object().to_owned())
318 .collect();
319 let range_parameters_tuple = vm.ctx.new_tuple(range_parameters);
320 (vm.ctx.types.range_type.to_owned(), range_parameters_tuple)
321 }
322
323 fn __getitem__(&self, subscript: PyObjectRef, vm: &VirtualMachine) -> PyResult {
324 match RangeIndex::try_from_object(vm, subscript)? {

Callers

nothing calls this directly

Calls 9

range_iter_reduceFunction · 0.85
collectMethod · 0.80
mapMethod · 0.45
iterMethod · 0.45
to_ownedMethod · 0.45
as_objectMethod · 0.45
new_tupleMethod · 0.45
cloneMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected