diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-07-23 14:45:26 -0700 |
|---|---|---|
| committer | Victor Stinner <vstinner@redhat.com> | 2018-07-23 23:45:26 +0200 |
| commit | 25b87d35675301a929982db6d37836666af4f715 (patch) | |
| tree | defd06b6204046407016db87928ec9b047f75007 /Python/ceval.c | |
| parent | 4e166ffd29b675238ccd94964743f6cb206d2235 (diff) | |
| download | cpython-git-25b87d35675301a929982db6d37836666af4f715.tar.gz | |
bpo-34190: Fix reference leak in call_function() (GH-8413) (GH-8418)
(cherry picked from commit 147d95511f59cfdd2d522f9d736f2335457bae20)
Co-authored-by: jdemeyer <jdemeyer@cage.ugent.be>
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 600147b7aa..0d1519bef4 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4565,12 +4565,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); |
