Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 147d955

Browse files
jdemeyervstinner
authored andcommitted
bpo-34190: Fix reference leak in call_function() (GH-8413)
1 parent caa331d commit 147d955

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

Python/ceval.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4576,12 +4576,15 @@ call_function(PyObject ***pp_stack, Py_ssize_t oparg, PyObject *kwnames)
45764576
profiling. */
45774577
PyObject *self = stack[0];
45784578
func = Py_TYPE(func)->tp_descr_get(func, self, (PyObject*)Py_TYPE(self));
4579-
if (func == NULL) {
4580-
return NULL;
4579+
if (func != NULL) {
4580+
C_TRACE(x, _PyCFunction_FastCallKeywords(func,
4581+
stack+1, nargs-1,
4582+
kwnames));
4583+
Py_DECREF(func);
4584+
}
4585+
else {
4586+
x = NULL;
45814587
}
4582-
C_TRACE(x, _PyCFunction_FastCallKeywords(func, stack+1, nargs-1,
4583-
kwnames));
4584-
Py_DECREF(func);
45854588
}
45864589
else {
45874590
x = _PyMethodDescr_FastCallKeywords(func, stack, nargs, kwnames);

0 commit comments

Comments
 (0)