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

Method slot_new

crates/vm/src/builtins/range.rs:351–361  ·  view source on GitHub ↗
(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

349
350 #[pyslot]
351 fn slot_new(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult {
352 let range = if args.args.len() <= 1 {
353 let stop = args.bind(vm)?;
354 Self::new(cls, stop, vm)
355 } else {
356 let (start, stop, step) = args.bind(vm)?;
357 Self::new_from(cls, start, stop, step, vm)
358 }?;
359
360 Ok(range.into())
361 }
362
363 // TODO: Uncomment when Python adds __class_getitem__ to range
364 // #[pyclassmethod]

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
lenMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected