[doc] Clarify that Popen.wait is only a busy-loop in certain cases
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 558
描述
Documentation
In the docs for Popen.wait(), it states:
Note The function is implemented using a busy loop (non-blocking call and short sleeps). Use the asyncio module for an asynchronous wait: see asyncio.create_subprocess_exec.
This is actually only true in a specific circumstance: when both using Posix/Unix and a timeout is given. If, on the other hand, no timeout is given, then it does not go into a busy-loop but instead blocks on os.waitpid(). And for Windows, it never goes into a busy-loop, as it uses the WaitForSingleObject() windows API.
This note in the docs caused me to refactor my code to use asyncio - only later did I actually check what python did internally and discovered the note was wrong.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中链接的 Popen.wait() 文档开始,并将该注释与此处描述的平台行为和 timeout 行为进行比较。修改该注释,将关于 busy-loop 的说法限制为带有 timeout 的 POSIX/Unix 等待,同时准确涵盖无 timeout 和 Windows 的情况。完成的标准是措辞在技术上正确,并保留 asyncio 指导。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 58/100