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

Method get_slice

crates/vm/src/protocol/sequence.rs:263–274  ·  view source on GitHub ↗
(&self, start: isize, stop: isize, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

261 }
262
263 pub fn get_slice(&self, start: isize, stop: isize, vm: &VirtualMachine) -> PyResult {
264 if let Ok(mapping) = self.obj.try_mapping(vm) {
265 let slice = PySlice {
266 start: Some(start.to_pyobject(vm)),
267 stop: stop.to_pyobject(vm),
268 step: None,
269 };
270 mapping.subscript(&slice.into_pyobject(vm), vm)
271 } else {
272 Err(vm.new_type_error(format!("'{}' object is unsliceable", self.obj.class())))
273 }
274 }
275
276 fn _ass_slice(
277 &self,

Callers

nothing calls this directly

Calls 6

try_mappingMethod · 0.80
SomeClass · 0.50
ErrClass · 0.50
to_pyobjectMethod · 0.45
subscriptMethod · 0.45
into_pyobjectMethod · 0.45

Tested by

no test coverage detected