⚡ Sangsakala Proxy 🏠 Home
Skip to content

Align native signal controls and handler dispatch - #9683

Draft
youknowdot wants to merge 3 commits into
RustPython:mainfrom
youknowdot:signal-control-conversions-group-20261104
Draft

youknowdot wants to merge 3 commits into
RustPython:mainfrom
youknowdot:signal-control-conversions-group-20261104

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Align native signal controls and ordinary handler dispatch with CPython 3.15:

  • Reuse shared PyTime conversion for bounded nanoseconds and ceiling-to-microsecond timer conversion, preserving argument order and platform time_t checks.
  • Preserve errno and strerror through the existing ItimerError/OSError builder.
  • Share exact-integer SIG_DFL/SIG_IGN classification across validation, startup, and dispatch. Retain main-interpreter checks and signed alarm/default-handler conversion.
  • Reuse ArgIntoBool for wakeup-fd keyword truthiness before fd conversion and signed pointer-sized socket conversion on Windows.
  • Preserve inherited ignored or foreign native SIGINT handlers at startup. Release replaced Python handlers outside the table borrow before their destructors can run.
  • Pass the current complete Python frame to signal callbacks through the existing frame helper. Invoke registered handlers normally so an object that loses its call reports TypeError instead of silently losing the signal.

Reference: CPython 3.15.0 signal module and complete-frame selection.

Validation

  • Independent source review against the exact CPython release passed, including conversion precedence, negative timer normalization, errno construction, platform branches, handler destruction/reentry, callable-int-subclass precedence, and complete-frame ownership.
  • Formatting, whitespace and normal commit hooks passed.
  • Latest head: cargo clippy --locked --offline -p rustpython-vm --all-targets --features threading -- -D warnings passed.
  • Latest head: cargo clippy --locked --offline -p rustpython-vm --all-targets passed with the existing no-thread Arc warning at _ctypes/base.rs:2246.
  • No RustPython runtime, CPython behavior probes, host signal/timer/mask/wakeup mutation, full workspace/C-API suites or cross-platform execution was performed. Windows and 32-bit paths remain source-reviewed only.
  • No test, Lib, workflow or marker edits.

Scope

This does not redesign process-global signal ownership across independently embedded runtimes, signal teardown, interrupt_main's producer semantics, or missing-handler diagnostics. In particular, this does not resolve or retire the shutdown interrupt_main expected failure. Ordinary dispatch and startup changes add no new native signal-handler operations or cross-thread frame reads.

AI assistance: OpenAI Codex performed source comparison, implementation and independent source review; model version was not exposed.

Reuse the shared time and truth-value converters, preserve timer errno,
and match native signal handler and wakeup-fd validation order and domains.

Assisted-by: OpenAI Codex:model version not exposed
Retain the checked time_t conversion on narrower hosts and bind socket fields only on Windows.

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

coderabbitai Bot commented Nov 4, 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

Keep ignored and foreign native SIGINT handlers during initialization and
release replaced Python handlers outside the table borrow. Share exact
native disposition classification and pass the current complete frame to
normal signal callback dispatch, retaining errors when a registered
object ceases to be callable.

No signal ownership, shutdown, or interrupt_main producer redesign is
included. Existing expected-failure markers remain pending runtime tests.

Assisted-by: OpenAI Codex:model version not exposed
@youknowdot youknowdot changed the title Align native signal control conversions with CPython 3.15 Align native signal controls and handler dispatch Nov 4, 2026
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.

1 participant