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

Function system_exit_code

crates/vm/src/exceptions.rs:1105–1116  ·  view source on GitHub ↗
(exc: PyBaseExceptionRef)

Source from the content-addressed store, hash-verified

1103}
1104
1105fn system_exit_code(exc: PyBaseExceptionRef) -> Option<PyObjectRef> {
1106 // SystemExit.code based on args length:
1107 // - size == 0: code is None
1108 // - size == 1: code is args[0]
1109 // - size > 1: code is args (the whole tuple)
1110 let args = exc.args.read();
1111 match args.len() {
1112 0 => None,
1113 1 => Some(args.first().unwrap().clone()),
1114 _ => Some(args.as_object().to_owned()),
1115 }
1116}
1117
1118#[cfg(feature = "serde")]
1119pub struct SerializeException<'vm, 's> {

Callers

nothing calls this directly

Calls 8

SomeClass · 0.50
readMethod · 0.45
lenMethod · 0.45
cloneMethod · 0.45
unwrapMethod · 0.45
firstMethod · 0.45
to_ownedMethod · 0.45
as_objectMethod · 0.45

Tested by

no test coverage detected