(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine)
| 126 | |
| 127 | #[pyslot] |
| 128 | fn slot_new(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult { |
| 129 | let slice: Self = match args.args.len() { |
| 130 | 0 => { |
| 131 | return Err(vm.new_type_error("slice() must have at least one arguments.")); |
| 132 | } |
| 133 | 1 => { |
| 134 | let stop = args.bind(vm)?; |
| 135 | Self { |
| 136 | start: None, |
| 137 | stop, |
| 138 | step: None, |
| 139 | } |
| 140 | } |
| 141 | _ => { |
| 142 | let (start, stop, step): (PyObjectRef, PyObjectRef, OptionalArg<PyObjectRef>) = |
| 143 | args.bind(vm)?; |
| 144 | Self { |
| 145 | start: Some(start), |
| 146 | stop, |
| 147 | step: step.into_option(), |
| 148 | } |
| 149 | } |
| 150 | }; |
| 151 | slice.into_ref_with_type(vm, cls).map(Into::into) |
| 152 | } |
| 153 | |
| 154 | pub(crate) fn inner_indices( |
| 155 | &self, |
nothing calls this directly
no test coverage detected