]> granicus.if.org Git - python/commitdiff
PyEval_CallObjectWithKeywords() doesn't inc/decref
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 22 Aug 2016 22:25:01 +0000 (00:25 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 22 Aug 2016 22:25:01 +0000 (00:25 +0200)
Issue #27809: PyEval_CallObjectWithKeywords() doesn't increment temporary the
reference counter of the args tuple (positional arguments). The caller already
holds a strong reference to it.

Python/ceval.c

index fd456ceed1ec5f9a209757b8d0c99b2b3fc6a3c2..f9759f0f70cff2444c5676c02f3ad7a48eabbb76 100644 (file)
@@ -4580,8 +4580,6 @@ PyEval_MergeCompilerFlags(PyCompilerFlags *cf)
 PyObject *
 PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs)
 {
-    PyObject *result;
-
 #ifdef Py_DEBUG
     /* PyEval_CallObjectWithKeywords() must not be called with an exception
        set. It raises a new exception if parameters are invalid or if
@@ -4605,11 +4603,7 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs)
         return NULL;
     }
 
-    Py_INCREF(args);
-    result = PyObject_Call(func, args, kwargs);
-    Py_DECREF(args);
-
-    return result;
+    return PyObject_Call(func, args, kwargs);
 }
 
 const char *