Skip to content

Use Argument Clinic for more functions and methods #155496

Description

@serhiy-storchaka

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions