Skip to content

gh-107570: Argument Clinic: report errors on the offending line - #155250

Merged
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:clinic-error-lineno
Aug 19, 2026
Merged

gh-107570: Argument Clinic: report errors on the offending line#155250
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:clinic-error-lineno

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 5, 2026

Copy link
Copy Markdown
Member

Errors raised while the docstring is checked were reported on the line which ends the clinic block:

Error in file 'p.c' on line 11:      # the "[clinic start generated code]*/" line
Docstring for 'm.f' does not have a summary line!

and errors raised while the code is generated were reported without a file name and a line number at all:

Error:
You cannot use optional groups ('[' and ']') unless all parameters are positional-only ('/').

Functions and parameters now record the line on which they are declared, and the function docstring records where it starts, so that such errors point at the offending line: the line which should have been left blank, the too long summary line, the first too long line of the docstring body, the second {parameters} marker, or the declaration of the function or the parameter.

Errors raised while the docstring is checked were reported on the line
which ends the clinic block, and errors raised while the code is generated
were reported without a file name and a line number at all.

Functions and parameters now record the line on which they are declared,
and the function docstring records where it starts, so that such errors
point at the offending line.
# Conflicts:
#	Tools/clinic/libclinic/parse_args.py
@serhiy-storchaka
serhiy-storchaka merged commit 9b05395 into python:main Aug 19, 2026
60 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the clinic-error-lineno branch August 19, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant