You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: test_keyboard_interrupt_during_a_fill_reaches_the_user fails when the test process inherits SIGINT as ignored #3213
I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct
Type of Bug
Something else (test-only failure)
Component
cuda.core
Describe the bug
cuda_core/tests/test_driver_table.py::test_keyboard_interrupt_during_a_fill_reaches_the_user failed on every run (10/10) when pytest was started as a background job of a non-interactive shell:
AssertionError: NOT INTERRUPTED
WARNING: cuda-bindings could not load the NVRTC: KeyboardInterrupt
A background job of a non-interactive shell inherits SIGINT as SIG_IGN (SigIgn: 0x7 in /proc/<pid>/status). Python installs its KeyboardInterrupt handler only when SIGINT is not ignored at startup, and PyErr_SetInterruptEx does nothing for an ignored signal. The interrupt that the fill re-arms is therefore dropped, and the child prints NOT INTERRUPTED. The subprocess that _run_code starts inherits the same disposition.
SIGINT state
Result
Inherited as ignored
3/3 failed
Restored to SIG_DFL before pytest
3/3 passed
Inherited as ignored, child installs signal.default_int_handler itself
The test passes however pytest was started; the interrupt it re-arms reaches the child as KeyboardInterrupt.
Proposed fix
Have _INTERRUPTED_CHILD call signal.signal(signal.SIGINT, signal.default_int_handler) before it patches the loader, so the test does not depend on how the runner was started. This is a 6-line change; I can open a PR.
The fix was written with Claude Opus 5.5 and reviewed by the contributor.
Activity
fix(tests): restore SIGINT handler in keyboard-interrupt fill child (#…