[Python-checkins] bpo-34190: Fix reference leak in call_function() (GH-8413)
Victor Stinner
webhook-mailer at python.org
Mon Jul 23 12:41:24 EDT 2018
https://github.com/python/cpython/commit/147d95511f59cfdd2d522f9d736f2335457bae20
commit: 147d95511f59cfdd2d522f9d736f2335457bae20
branch: master
author: jdemeyer <jdemeyer at cage.ugent.be>
committer: Victor Stinner <vstinner at redhat.com>
date: 2018-07-23T18:41:20+02:00
summary:
bpo-34190: Fix reference leak in call_function() (GH-8413)
files:
M Python/ceval.c
diff --git a/Python/ceval.c b/Python/ceval.c
index 465e03012a3f..8f0e0e00c2b9 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);
More information about the Python-checkins
mailing list