_PyOS_SigintEvent() is needed for interruptible waiting on main thread
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
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
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先檢查 CPython PR #108605,以及 TensorStore 的 python/tensorstore/future.cc 第 105 行中對 _PyOS_SigintEvent 的使用。追蹤移除公開標頭檔宣告會如何影響擴充函式庫,並比較可用的訊號喚醒替代方案。完成的標準是為函式庫提供一種受支援的方式,使其能夠中斷主執行緒上的同步等待,同時保留 Ctrl+C 的行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- api, operating-systems
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100