Skip to content

gh-155373: Inline the parsing code of optional groups in Argument Clinic - #155374

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:clinic-groups-inline
Open

gh-155373: Inline the parsing code of optional groups in Argument Clinic#155374
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:clinic-groups-inline

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Instead of one PyArg_ParseTuple() call per number of arguments, generate the inlined code of the converters, as for all other parsing methods. Every argument is parsed once: the groups on the left are parsed if the number of arguments is large enough and shift the following arguments, the required parameters are parsed unconditionally, and the groups on the right depend on the number of arguments.

Such functions now use the fastcall convention, except for constructors and other functions which need a tuple. The hand-written subpad entry in Modules/_cursesmodule.c, which reuses the function generated for _curses.window.subwin, is updated accordingly.

Errors for a wrong type of an argument are now reported by the converter, as in other functions. Where a group can shift the position of an argument, the message does not contain its number, because it differs between the calls.

Converters whose code cannot be inlined (str(encoding=...) for example) keep the current code.

…nt Clinic

Instead of one PyArg_ParseTuple() call per number of arguments, generate
the inlined code of the converters, as for all other parsing methods.
Every argument is parsed once.

Such functions now use the fastcall convention, except for constructors
and other functions which need a tuple.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant