(
start: BigInt,
length: BigInt,
step: BigInt,
index: usize,
vm: &VirtualMachine,
)
| 712 | } |
| 713 | |
| 714 | fn range_iter_reduce( |
| 715 | start: BigInt, |
| 716 | length: BigInt, |
| 717 | step: BigInt, |
| 718 | index: usize, |
| 719 | vm: &VirtualMachine, |
| 720 | ) -> PyResult<PyTupleRef> { |
| 721 | let iter = builtins_iter(vm); |
| 722 | let stop = start.clone() + length * step.clone(); |
| 723 | let range = PyRange { |
| 724 | start: PyInt::from(start).into_ref(&vm.ctx), |
| 725 | stop: PyInt::from(stop).into_ref(&vm.ctx), |
| 726 | step: PyInt::from(step).into_ref(&vm.ctx), |
| 727 | }; |
| 728 | Ok(vm.new_tuple((iter, (range,), index))) |
| 729 | } |
| 730 | |
| 731 | // Silently clips state (i.e index) in range [0, usize::MAX]. |
| 732 | fn range_state(length: &BigInt, state: PyObjectRef, vm: &VirtualMachine) -> PyResult<usize> { |
no test coverage detected