Potential Windows-specific lost event race in the implementation of time.sleep
未关闭
还没有人认领这个 Issue。
extension-modules
OS-windows
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
Bug description:
In the Windows-specific implementation of time.sleep there appears this code:
If a control-C event happens after PyErr_CheckSignals returns, but before ResetEvent is called, I believe that event may be lost.
This is probably a hard race window to hit, and I don't have a Windows development environment, so I have not confirmed that it is possible.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先从链接行中的 Modules/timemodule.c 里 Windows 专用的 time.sleep 实现开始,然后检查 PyErr_CheckSignals 和 ResetEvent 的执行顺序。调查在 Windows 上 control-C 事件是否可能在该时间窗口内发生;确认或排除丢失事件的竞态,并在适用时通过覆盖测试记录或修正该行为,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- operating-systems
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100