gh-118814: Fix the TypeVar constructor when name is passed by keyword (GH-122664)

Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for
positional-or-keyword parameter is passed by keyword.
There was only one such case in the stdlib -- the TypeVar constructor.
This commit is contained in:
Serhiy Storchaka 2024-08-07 23:30:10 +03:00 committed by GitHub
parent e73e7a7abd
commit 540fcc62f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 165 additions and 7 deletions

View file

@ -2601,7 +2601,7 @@ _PyArg_UnpackKeywordsWithVararg(PyObject *const *args, Py_ssize_t nargs,
*
* Otherwise, we leave a place at `buf[vararg]` for vararg tuple
* so the index is `i + 1`. */
if (nargs < vararg && i != vararg) {
if (i < vararg) {
buf[i] = current_arg;
}
else {