Use Argument Clinic for more functions and methods
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the remaining PyMethodDef entries in the listed modules, along with the Argument Clinic conventions already used in CPython. Exclude socket.sendto(), socket.setsockopt(), socket.ioctl(), and module-level getattr(); done means eligible functions and methods use Argument Clinic rather than the stated parsing and calling conventions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- backend, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100