Skip to content

Argument Clinic: a lone optional group generates METH_O #155266

Closed

Description

@serhiy-storchaka

Bug report

If the only parameter of a function is in an optional group, Argument Clinic generates METH_O:

/*[clinic input]
m.f
    [
    a: object
    ]
    /
[clinic start generated code]*/

#define M_F_METHODDEF    \
    {"f", (PyCFunction)m_f, METH_O, m_f__doc__},

static PyObject *
m_f(PyObject *module, int group_right_1, PyObject *a)

The group is ignored: the argument becomes mandatory, and group_right_1 is never computed nor passed.

Linked PRs

Activity

  1. added a commit that references this issue on Aug 6, 2026
  2. added a commit that references this issue on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions