(signalnum: i32, vm: &VirtualMachine)
| 531 | #[cfg(unix)] |
| 532 | #[pyfunction] |
| 533 | fn strsignal(signalnum: i32, vm: &VirtualMachine) -> PyResult<Option<String>> { |
| 534 | if signalnum < 1 || signalnum >= signal::NSIG as i32 { |
| 535 | return Err(vm.new_value_error(format!("signal number {} out of range", signalnum))); |
| 536 | } |
| 537 | let s = unsafe { libc::strsignal(signalnum) }; |
| 538 | if s.is_null() { |
| 539 | Ok(None) |
| 540 | } else { |
| 541 | let cstr = unsafe { core::ffi::CStr::from_ptr(s) }; |
| 542 | Ok(Some(cstr.to_string_lossy().into_owned())) |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | #[cfg(windows)] |
| 547 | #[pyfunction] |
nothing calls this directly
no test coverage detected