Skip to content

PyModule_FromSlotsAndSpec and PyModule_GetToken exposed without named parameters #143883

@ngoldbaum

Description

@ngoldbaum

Most of the public functions in the C API have named parameters and both of these functions are documented with named parameters:

https://docs.python.org/3.15/c-api/module.html#c.PyModule_FromSlotsAndSpec
https://docs.python.org/3.15/c-api/module.html#c.PyModule_GetToken

While wrapping these APIs for PyO3, I noticed that the public definitions just have types for the first parameter without an explicit name:

#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= _Py_PACK_VERSION(3, 15)
PyAPI_FUNC(PyObject *) PyModule_FromSlotsAndSpec(const PyModuleDef_Slot *,
PyObject *spec);
PyAPI_FUNC(int) PyModule_Exec(PyObject *mod);
PyAPI_FUNC(int) PyModule_GetStateSize(PyObject *mod, Py_ssize_t *result);
PyAPI_FUNC(int) PyModule_GetToken(PyObject *, void **result);
#endif

It'd be nice for those interfaces to match the names in the docs.

This code was added in #140556. I don't see any discussion about this, I think it was just missed.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions