non-blocking reads of binary and text streams handle no-data differently
オープン
まだ誰も着手していません。
stdlib
topic-subprocess
type-bug
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
proc = subprocess.Popen(
['bash', '-c', 'sleep 10; echo hello'],
stdout=subprocess.PIPE,
text=True
)
os.set_blocking(proc.stdout.fileno(), False)
print(repr(proc.stdout.read(8192)))
Refer to issue #57531 for discussion on what should happen in general, but I'm filing this to point out that when text=True the output is an empty string (indistinguishable from EOF, which is a problem), and when text=False the result is None (while an empty string is produced only on EOF).
They should probably behave consistently, and also EOF should be distinguishable from no-data-yet; making the binary behaviour preferable.
CPython versions tested on:
3.13
Operating systems tested on:
Linux
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
この issue の subprocess.Popen の例から始め、CPython 3.13/Linux で text=True と text=False のノンブロッキング読み取り結果を比較してください。提案されている一般的な動作については issue #57531 を読んでください。no-data-yet と EOF を区別でき、バイナリストリームとテキストストリームが一貫して動作すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- operating-systems
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100