⚡ Sangsakala Proxy 🏠 Home
Skip to content

Align select-family conversion and timeouts - #9663

Draft
youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:fix/select-conversion-group-20261103
Draft

youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:fix/select-conversion-group-20261103

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Group the related select-family conversion and timeout fixes around the VM's existing signed pytime conversion, rather than maintaining another conversion implementation.

  • Share seconds/milliseconds scaling, index-before-float conversion, signed nanosecond bounds, and timeout rounding. Use checked platform timeval/timespec conversion and monotonic deadlines after descriptor/changelist callbacks.
  • Reuse Fildes and derived raw argument binding. Preserve argument roots and callback/error ordering for select, poll, epoll, and kqueue.
  • Accept all unsigned-short poll event bits, preserve returned high event bits, and report ENOENT for modifying an unregistered descriptor.
  • Use ppoll on Linux/Android for nanosecond precision and waits beyond the signed-millisecond limit; retain checked poll fallback elsewhere and recompute remaining waits after EINTR.
  • Align epoll registration keywords, maxevents checks, closed-state ordering, signed timeout limits, and sub-millisecond negative rounding.

No test or snippet edits. The overlaps with #9652's separate thread-timeout additions and #8954's C-API time helpers were checked by clean three-way compositions of pytime.rs.

Reference

Compared against CPython v3.15.0 Modules/selectmodule.c, its Clinic bindings, and Python/pytime.c.

Validation

  • Focused VM, host_env, and stdlib threading cargo check --offline: passed.
  • Matching strict cargo clippy --offline -- -D warnings: passed.
  • Independent source review, formatting, git diff --check, and normal repository pre-commit hooks: passed.
  • Bounded CPython 3.15 probes covered conversion errors, zero waits, a ready owned pipe with a large timeout, epoll keywords, and POLLRDHUP from an owned socket pair.
  • Native RustPython execution, full workspace/C-API tests, and cross-platform builds were not run under the current task restrictions. Hosted CI remains required.

Platform-specific kqueue, Windows, and 32-bit paths are source-reviewed, not runtime-validated. The pre-existing epoll signal-handler-close locking behavior remains outside this conversion patch. A 32-bit ppoll time_t overflow retains a generic timeout-overflow diagnostic.

AI assistance

OpenAI Codex assisted with source comparison, implementation, review, and validation. The model version is not exposed by this environment.

Reuse signed pytime conversion and descriptor/argument binding across select, poll, epoll and kqueue. Preserve conversion order, argument roots, timeout bounds and rounding, and poll event masks. Use ppoll where supported for nanosecond deadlines.

Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@youknowone

Copy link
Copy Markdown
Member

todo: need review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants