python / python/cpython

_PyOS_SigintEvent() is needed for interruptible waiting on main thread

オープン
#128,684 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

topic-C-API type-bug
主要言語
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず CPython PR #108605 と、TensorStore の python/tensorstore/future.cc の 105 行目にある _PyOS_SigintEvent の使用箇所を確認してください。public header の宣言を削除した場合に拡張ライブラリへどのような影響があるかを追跡し、利用可能なシグナルによるウェイクアップの代替手段を比較してください。完了の条件は、Ctrl+C の動作を維持したまま、ライブラリがメインスレッド上の同期的な待機を中断できる、サポートされた方法を提供することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api, operating-systems
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。