]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix warning in _PyCFunction_FastCallKeywords()
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 12 Sep 2016 19:33:26 +0000 (15:33 -0400)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 12 Sep 2016 19:33:26 +0000 (15:33 -0400)
Issue #28105.

Objects/methodobject.c

index 19e8114d4af3811b44e0c7871c9c2c5f430c1635..c2001f0169b030f316169d7001439426d5506c77 100644 (file)
@@ -273,7 +273,7 @@ _PyCFunction_FastCallKeywords(PyObject *func, PyObject **stack,
                               Py_ssize_t nargs, PyObject *kwnames)
 {
     PyObject *kwdict, *result;
-    Py_ssize_t nkwargs;
+    Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames);
 
     assert(PyCFunction_Check(func));
     assert(nargs >= 0);
@@ -282,7 +282,6 @@ _PyCFunction_FastCallKeywords(PyObject *func, PyObject **stack,
     /* kwnames must only contains str strings, no subclass, and all keys must
        be unique */
 
-    nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames);
     if (nkwargs > 0) {
         kwdict = _PyStack_AsDict(stack + nargs, kwnames);
         if (kwdict == NULL) {