[Python-checkins] cpython: Fix warning in _PyCFunction_FastCallKeywords()

victor.stinner python-checkins at python.org
Mon Sep 12 15:33:57 EDT 2016


https://hg.python.org/cpython/rev/e67e685a1301
changeset:   103714:e67e685a1301
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Sep 12 15:33:26 2016 -0400
summary:
  Fix warning in _PyCFunction_FastCallKeywords()

Issue #28105.

files:
  Objects/methodobject.c |  3 +--
  1 files changed, 1 insertions(+), 2 deletions(-)


diff --git a/Objects/methodobject.c b/Objects/methodobject.c
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -273,7 +273,7 @@
                               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 @@
     /* 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) {

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list