[Python-checkins] cpython: PyEval_CallObjectWithKeywords() doesn't inc/decref

victor.stinner python-checkins at python.org
Mon Aug 22 18:32:47 EDT 2016


https://hg.python.org/cpython/rev/bf2d88cf039a
changeset:   102852:bf2d88cf039a
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Aug 23 00:25:01 2016 +0200
summary:
  PyEval_CallObjectWithKeywords() doesn't inc/decref

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.

files:
  Python/ceval.c |  8 +-------
  1 files changed, 1 insertions(+), 7 deletions(-)


diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4580,8 +4580,6 @@
 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 @@
         return NULL;
     }
 
-    Py_INCREF(args);
-    result = PyObject_Call(func, args, kwargs);
-    Py_DECREF(args);
-
-    return result;
+    return PyObject_Call(func, args, kwargs);
 }
 
 const char *

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


More information about the Python-checkins mailing list