diff options
author | jdemeyer <jdemeyer@cage.ugent.be> | 2018-07-23 16:41:20 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2018-07-23 16:41:20 (GMT) |
commit | 147d95511f59cfdd2d522f9d736f2335457bae20 (patch) | |
tree | 90d5a4f3b260f2f5a62c88e9df7e6e149e50f26c /Python/ceval.c | |
parent | caa331d492acc67d8f4edd16542cebfabbbe1e79 (diff) | |
download | cpython-147d95511f59cfdd2d522f9d736f2335457bae20.zip cpython-147d95511f59cfdd2d522f9d736f2335457bae20.tar.gz cpython-147d95511f59cfdd2d522f9d736f2335457bae20.tar.bz2 |
bpo-34190: Fix reference leak in call_function() (GH-8413)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 465e030..8f0e0e0 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4576,12 +4576,15 @@ call_function(PyObject ***pp_stack, Py_ssize_t oparg, PyObject *kwnames) profiling. */ PyObject *self = stack[0]; func = Py_TYPE(func)->tp_descr_get(func, self, (PyObject*)Py_TYPE(self)); - if (func == NULL) { - return NULL; + if (func != NULL) { + C_TRACE(x, _PyCFunction_FastCallKeywords(func, + stack+1, nargs-1, + kwnames)); + Py_DECREF(func); + } + else { + x = NULL; } - C_TRACE(x, _PyCFunction_FastCallKeywords(func, stack+1, nargs-1, - kwnames)); - Py_DECREF(func); } else { x = _PyMethodDescr_FastCallKeywords(func, stack, nargs, kwnames); |