Failure during the print of select.select output with unblocking sys.stdin
未关闭
还没有人认领这个 Issue。
extension-modules
topic-socket
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- 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