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

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:21 +03:00 committed by GitHub
parent bc8368e9d0
commit 1fd1c6c738
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 165 additions and 7 deletions

View file

@ -2574,7 +2574,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 {