]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-20291: Fix MSVC warnings in getargs.c (GH-27211)
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Sat, 17 Jul 2021 11:09:18 +0000 (19:09 +0800)
committerGitHub <noreply@github.com>
Sat, 17 Jul 2021 11:09:18 +0000 (14:09 +0300)
* Fix MSVC warnings in getargs.c

* apply suggestions

Co-Authored-By: Batuhan Taskaya <batuhan@python.org>
Co-authored-by: Batuhan Taskaya <batuhan@python.org>
Python/getargs.c

index 330f2b456b38733383562d0a9bfca133af27f6e6..3fab3b5efefc286c41d2cc6b80fd36a8a61ece88 100644 (file)
@@ -2552,7 +2552,8 @@ _PyArg_UnpackKeywordsWithVararg(PyObject *const *args, Py_ssize_t nargs,
     }
 
     /* copy keyword args using kwtuple to drive process */
-    for (i = Py_MAX((int)nargs, posonly) - varargssize; i < maxargs; i++) {
+    for (i = Py_MAX((int)nargs, posonly) -
+         Py_SAFE_DOWNCAST(varargssize, Py_ssize_t, int); i < maxargs; i++) {
         if (nkwargs) {
             keyword = PyTuple_GET_ITEM(kwtuple, i - posonly);
             if (kwargs != NULL) {