Importing ctypes results in extra open libffi file descriptor since 3.14
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
On python 3.13 (Fedora), importing ctypes results in the following output from lsfd:
python3 893377 daandemeyer mem r-x--- REG 0:37 0 304862113 /usr/lib64/libffi.so.8.1.4
python3 893377 daandemeyer mem r----- REG 0:37 0 304862113 /usr/lib64/libffi.so.8.1.4
python3 893377 daandemeyer mem r----- REG 0:37 0 304862113 /usr/lib64/libffi.so.8.1.4
python3 893377 daandemeyer mem rw---- REG 0:37 0 304862113 /usr/lib64/libffi.so.8.1.4
On python 3.14 (Fedora), importing ctypes results in the following output from lsfd:
python3 892407 daandemeyer 5 r----- REG 0:238 1342 7553 /usr/lib64/libffi.so.8.2.0
This ended up breaking https://github.com/systemd/mkosi because it relied on the fact that no new regular file descriptors were opened by importing ctypes (on python 3.14 the file descriptor shows up in /proc/self/fd whereas on python 3.13 the file descriptors are memory maps which don't show up in /proc/self/fd). I searched through the commit list and couldn't find the commit that introduced this change. It also didn't seem to be documented in the release notes. Can anyone point me to the commit introducing this change and the reasoning behind it?
CPython versions tested on:
3.14
Operating systems tested on:
Linux
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,按照报告中的方法,使用 lsfd 和 /proc/self/fd 比较 Linux 上 Python 3.13 和 3.14 中的 ctypes 导入情况。追踪 CPython 的提交历史,找出使 libffi 显示为普通文件描述符的更改,然后确定其原因,以及这种行为是否需要回归修复或发布说明文档。完成的标准是明确识别并验证该更改及其原因。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- operating-systems
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 52/100