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

Function check_signum

crates/stdlib/src/faulthandler.rs:1085–1101  ·  view source on GitHub ↗
(signum: i32, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1083
1084 #[cfg(unix)]
1085 fn check_signum(signum: i32, vm: &VirtualMachine) -> PyResult<()> {
1086 // Check if it's a fatal signal (faulthandler.c uses faulthandler_handlers array)
1087 let is_fatal = unsafe { FAULTHANDLER_HANDLERS.iter().any(|h| h.signum == signum) };
1088 if is_fatal {
1089 return Err(vm.new_runtime_error(format!(
1090 "signal {} cannot be registered, use enable() instead",
1091 signum
1092 )));
1093 }
1094
1095 // Check if signal is in valid range
1096 if !(1..64).contains(&signum) {
1097 return Err(vm.new_value_error("signal number out of range"));
1098 }
1099
1100 Ok(())
1101 }
1102
1103 #[cfg(unix)]
1104 #[derive(FromArgs)]

Callers 2

registerFunction · 0.85
unregisterFunction · 0.85

Calls 3

ErrClass · 0.50
iterMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected