Failure during the print of select.select output with unblocking sys.stdin
未關閉
還沒有人認領這個 Issue。
extension-modules
topic-socket
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
This code terminates with error messages after several loop iterations:
import sys
import os
import select
os.set_blocking(sys.stdin.fileno(), False)
while True:
print('>')
ready = select.select([sys.stdin, ], [], [], 0.0)[0]
print(f'< ready={ready}')
$ python3.11 stdin-nonblocking-bug-report.py
<... skip many iterations ...>
< ready=[]
>
< ready=[]
>
< ready=[]
Traceback (most recent call last):
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
Exception ignored in sys.unraisablehook: <built-in function unraisablehook>
$ echo $?
120
The failure occurs in print(f'< ready={ready}').
Python-3.11
FreeBSD 14.1
CPython versions tested on:
3.11
Operating systems tested on:
Other
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從提供的 reproducer 開始,該 reproducer 將 sys.stdin 設為 nonblocking,並在列印前反覆呼叫 select.select。在 Python 3.11 和 FreeBSD 14.1 上重現該失敗,然後追蹤 stdout 列印和 shutdown 路徑以找出原因。在所述條件下迴圈不再產生回報的 unraisable I/O error,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- operating-systems
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100