Use Argument Clinic for more functions and methods
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Many functions and methods implemented in C still parse their arguments with PyArg_ParseTuple() or PyArg_UnpackTuple().
They have no signature for introspection and use the slow METH_VARARGS calling convention.
There are 131 such PyMethodDef entries outside the test modules: _curses 25, _ctypes 16, _interpchannels 13 (GH-139141), time 11, _io 9, _tkinter 8, _thread 6, _csv 5, socket 3, sys 3, and 32 more in 27 files.
A few of them cannot be converted: the behaviour of socket.sendto(), socket.setsockopt() and socket.ioctl() depends on the number or the value of the arguments, and Argument Clinic rejects module-level __getattr__() as a special method.
I am going to submit a separate PR per module.
Linked PRs
- gh-155511
- gh-155512
- gh-155513
- gh-155514
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先检查所列模块中剩余的 PyMethodDef 条目,以及 CPython 中已经使用的 Argument Clinic 约定。排除 socket.sendto()、socket.setsockopt()、socket.ioctl() 和模块级别的 getattr();当符合条件的函数和方法使用 Argument Clinic,而不是所述的解析和调用约定时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, python
- 领域
- backend, tooling
- Issue 类型
- 重构
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100