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

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.
(cherry picked from commit 540fcc62f5)
This commit is contained in:
Serhiy Storchaka 2024-08-08 09:49:50 +03:00 committed by GitHub
parent 8f4892ac52
commit f2cc8ad989
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 151 additions and 7 deletions

View file

@ -2640,7 +2640,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) {
if (i < vararg) {
buf[i] = current_arg;
}
else {