test_initconfig_get_api fails on platforms where malloc(0) returns NULL
未关闭
还没有人认领这个 Issue。
tests
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
test_initconfig_get_api (Programs/_testembed.c) executes the code
assert(PyInitConfig_GetStrList(config, "xoptions", &length, &items) == 0);
assert(length == 0);
PyInitConfig_GetStrList has malloc
*items = malloc(list->length * sizeof(char*));
if length is zero the behavior of malloc(0) is implementation defined, this seems to be problematic on platforms where malloc of zero returns NULL.
CPython versions tested on:
3.14
Operating systems tested on:
Other
Linked PRs
- gh-153816
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Programs/_testembed.c 中的 test_initconfig_get_api 开始,跟踪针对长度为零的 xoptions 列表的 PyInitConfig_GetStrList 调用。检查在 malloc(0) 返回 NULL 的平台上该实现的分配行为,然后运行目标测试,确认测试通过且不改变预期的零长度。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, python
- 领域
- api, testing-qa
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 30/100