cleanup the signals module#8076
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a shared SIGNUM_RANGE and refactors signal modules: reorganizes imports, centralizes signal-number iteration/validation, consolidates itimer error handling, standardizes wakeup-fd bookkeeping, and unifies notification and CPython-compatible signal APIs across Unix and Windows. ChangesSignal Handling Consolidation
🎯 4 (Complex) | ⏱️ ~60 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/vm/src/stdlib/_signal.rs`:
- Around line 419-424: The change incorrectly reuses SIGNUM_RANGE to reject
signal 0 in strsignal(), causing ValueError for lookups that
host_signal::strsignal(signalnum) can legitimately handle (e.g., on Unix).
Remove or relax the SIGNUM_RANGE check from the strsignal function (the
#[pyfunction] fn strsignal(signalnum: i32, vm: &VirtualMachine) ->
PyResult<Option<String>>) so it does not reject 0 up front; instead, call
host_signal::strsignal(signalnum) directly and only error if that host call
indicates an invalid signal, keeping the existing ValueError behavior elsewhere
that uses SIGNUM_RANGE for delivery-only validation.
- Around line 482-485: The ValueError message created via vm.new_value_error
currently claims a closed interval "[1, {SIGNUM_RANGE.end}]" while SIGNUM_RANGE
is half-open; update the error text in the vm.new_value_error call so the upper
bound reflects the actual allowed value (e.g., use format!("signal number out of
range [1, {}]", SIGNUM_RANGE.end - 1) or state the half-open form like "[1,
{})") so the message matches SIGNUM_RANGE.contains() validation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 73fe0c56-24f1-48d5-b1b6-000b66de91df
📒 Files selected for processing (2)
crates/vm/src/signal.rscrates/vm/src/stdlib/_signal.rs
Summary
Summary by CodeRabbit
Refactor
Bug Fixes
Notes