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

Function exit

crates/vm/src/stdlib/sys.rs:796–805  ·  view source on GitHub ↗
(code: OptionalArg<PyObjectRef>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

794
795 #[pyfunction]
796 fn exit(code: OptionalArg<PyObjectRef>, vm: &VirtualMachine) -> PyResult {
797 let status = code.unwrap_or_none(vm);
798 let args = if let Some(status_tuple) = status.downcast_ref::<PyTuple>() {
799 status_tuple.as_slice().to_vec()
800 } else {
801 vec![status]
802 };
803 let exc = vm.invoke_exception(vm.ctx.exceptions.system_exit.to_owned(), args)?;
804 Err(exc)
805 }
806
807 #[pyfunction]
808 fn call_tracing(func: PyObjectRef, args: PyTupleRef, vm: &VirtualMachine) -> PyResult {

Callers

nothing calls this directly

Calls 6

to_vecMethod · 0.80
invoke_exceptionMethod · 0.80
ErrClass · 0.50
unwrap_or_noneMethod · 0.45
as_sliceMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected