Skip to content

Normalise Argument Clinic error messages #107614

Closed
@erlend-aasland

Description

@erlend-aasland

Argument Clinic is pretty good at disallowing weird corner cases and producing error messages (there are 130 fail(..)s sprinkled around clinic.py!). Unfortunately, many of the error messages do not wrap the line or token in question, nor the function/module/class name in question in quotes. Also, some error messages contain line breaks in unexpected places.

Some examples:

Error message with unexpected line break

Clinic input:

/*[clinic input]
function
    a: int = 0
    b: int
[clinic start generated code]*/
$ python3.12 Tools/clinic/clinic.py test.c
Error in file 'test.c' on line 4:
Can't have a parameter without a default ('b')
after a parameter with a default!

Clinic input:

/*[clinic input]
function
    b: int
    *
[clinic start generated code]*/

Error message:

$ python3.12 Tools/clinic/clinic.py test.c
Error in file 'test.c' on line 5:
Function function specifies '*' without any parameters afterwards.

Suggesting to normalise Argument Clinic error messages, using the following guidelines:

  • always wrap the offending line, token, or name in quotes
  • no line break; the entire error message should be on one line

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