You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Re-work support of var-positional parameters in Argument Clinic #122943
When fixing some bugs (#118814, #122688) I noticed also design problems in _PyArg_UnpackKeywordsWithVararg().
Its vararg parameter is always equal to maxpos, therefore it is redundant.
Inserting a new tuple between values for positional and keyword-only parameters adds complexity in the _PyArg_UnpackKeywordsWithVararg() code which caused bugs.
Since it is the only argument value which is a strong reference, it adds complexity for cleanup after calling _PyArg_UnpackKeywordsWithVararg().
This large code is mostly a duplication of _PyArg_UnpackKeywords().
But it lacks some microoptimizations.
And produces wrong error messages in some corner cases.
Also some cases (like var-positional parameter after optional parameters) were not supported.
So I re-worked it in several steps:
Removed the vararg parameter from _PyArg_UnpackKeywordsWithVararg().
Moved creation of the tuple for var-positional parameter out from _PyArg_UnpackKeywordsWithVararg().
Refactored Argument Clinic code: it now generates similar code for var-positional parameter in functions with and without keyword parameters. The generated code is now more optimal and more cases are now supported. This is a large step.
Finally, _PyArg_UnpackKeywordsWithVararg() was merged with _PyArg_UnpackKeywords() which now got a new flag.
Changes in most of Argument Clinic generated files (which correspond to unchanged source files) can be ignored. Sorry, all these review requests are false.
Activity
pythongh-122943: Rework support of var-positional parameter in Argume…
serhiy-storchaka commentedon Aug 12, 2024
Changes in most of Argument Clinic generated files (which correspond to unchanged source files) can be ignored. Sorry, all these review requests are false.
pythongh-122943: Rework support of var-positional parameter in Argume…
gh-122943: Rework support of var-positional parameter in Argument Cli…
pythongh-122943: Remove the object converter for var-positional param…
pythongh-122943: Remove the object converter for var-positional param…
gh-122943: Remove the object converter for var-positional parameter (G…
pythongh-122943: Add the varpos parameter in _PyArg_UnpackKeywords
pythongh-122943: Add the varpos parameter in _PyArg_UnpackKeywords
pythongh-122943: Move code generation for var-positional parameter to…
pythongh-122943: Move code generation for var-positional parameter to…
pythongh-122943: Move code generation for var-positional parameter to…
gh-122943: Move code generation for var-positional parameter to conve…
gh-122943: Add the varpos parameter in _PyArg_UnpackKeywords (GH-126564)
pythongh-122943: Rework support of var-positional parameter in Argume…
pythongh-122943: Remove the object converter for var-positional param…
pythongh-122943: Move code generation for var-positional parameter to…
pythongh-122943: Add the varpos parameter in _PyArg_UnpackKeywords (p…
pythongh-122943: Rework support of var-positional parameter in Argume…
pythongh-122943: Remove the object converter for var-positional param…
pythongh-122943: Move code generation for var-positional parameter to…
pythongh-122943: Add the varpos parameter in _PyArg_UnpackKeywords (p…