pylifecycle.c: Multiple init/fini cleanup bugs
未关闭
还没有人认领这个 Issue。
interpreter-core
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
Parent: https://github.com/python/cpython/issues/146102
https://gist.github.com/devdanzin/b022ff2d1304a4b2b8d3d8750abd8da5
pylifecycle.c: Multiple init/fini cleanup bugs
Summary
5 bugs in interpreter lifecycle:
- new_interpreter (line 2534):
return statusbypasses switch-back aftersave_tstatedetach → thread state corruption. - pycore_init_builtins (line 860): Direct
returnleaksbimodref. - add_main_module (line 2762):
bimod/loaderrefs leaked onPyDict_SetItemStringfailure. - finalize_clear_modules_dict (line 1685): Return value of
PyObject_CallMethodNoArgsnever DECREF'd. - init_sys_streams (line 3019-3031): Unchecked
PySys_SetObjectfor stdin/stdout (stderr correctly checked).
CPython versions tested on:
CPython main branch, 3.15
Operating systems tested on:
No response
Linked PRs
- gh-149631
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先从父 issue 和链接的 gist 开始,然后检查 pylifecycle.c 中的 new_interpreter、pycore_init_builtins、add_main_module、finalize_clear_modules_dict 和 init_sys_streams。检查每条报告的失败路径,并使用链接的 PR gh-149631 了解现有上下文。完成标准是解决全部五个 lifecycle 清理问题,同时不引入新的引用或 thread-state 问题。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, python
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100