_PyOS_SigintEvent() is needed for interruptible waiting on main thread
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
Moved from https://github.com/python/cpython/pull/108605#issuecomment-2521215855
In https://github.com/python/cpython/pull/108605, _PyOS_SigintEvent was removed from the public headers.
TensorStore relies on that function here: https://github.com/google/tensorstore/blob/eda046b10158e7d82fdb0f23aeecdfdeb8ac5aa3/python/tensorstore/future.cc#L105 to enable synchronously blocking on the readiness of a custom Future type while allowing Ctrl+C to interrupt when running on the main thread.
The current workaround is to manually declare the function since the symbol is still available.
I'm not aware of a usable alternative. Since signal.set_wakeup_fd only allows a single fd to be set globally, it isn't usable from a library. The best alternative would probably be to poll by waking up every few hundred milliseconds.
CPython versions tested on:
3.13
Operating systems tested on:
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing CPython PR #108605 and the use of _PyOS_SigintEvent in TensorStore's python/tensorstore/future.cc at line 105. Trace how removing the public-header declaration affects extension libraries and compare the available signal-wakeup alternatives. Done means providing a supported way for a library to interrupt synchronous waiting on the main thread, with the behavior preserved for Ctrl+C.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100