Skip to content

Commit c632c81

Browse files
committed
Keep signal platform conversions explicit
Retain the checked time_t conversion on narrower hosts and bind socket fields only on Windows. Assisted-by: OpenAI Codex:model version not exposed
1 parent 17abd92 commit c632c81

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎crates/vm/src/stdlib/_signal.rs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ pub(crate) mod _signal {
351351
let nanoseconds = pytime::from_seconds_object(object, Round::Ceiling, vm)?;
352352
let microseconds = Round::Ceiling.divide(nanoseconds, 1_000);
353353
let seconds = microseconds.div_euclid(1_000_000);
354+
#[allow(
355+
clippy::useless_conversion,
356+
reason = "time_t may be narrower on 32-bit targets"
357+
)]
354358
let tv_sec = seconds
355359
.try_into()
356360
.map_err(|_| vm.new_overflow_error("timestamp out of range for platform time_t"))?;
@@ -385,10 +389,8 @@ pub(crate) mod _signal {
385389
fn set_wakeup_fd(args: SetWakeupFdArgs, vm: &VirtualMachine) -> PyResult<i64> {
386390
// The keyword truth value is parsed before the fd conversion in CPython.
387391
let fd = args.fd.try_to_value::<WakeupFd>(vm)?;
388-
let fd = cfg_select! {
389-
windows => fd.0,
390-
_ => fd,
391-
};
392+
#[cfg(windows)]
393+
let fd = fd.0;
392394

393395
if !vm.is_main_thread() || !vm.state.is_main_interpreter() {
394396
return Err(vm.new_value_error(

0 commit comments

Comments
 (0)