# HG changeset patch # Parent d3a9b055206c1483b1bbe61db26ab5dc3f2d8b10 Issue #25716: Fix memory leak in call_method() and call_maybe() Fix by Myron Walker. Also remove SLOT2() macro which is no longer used. diff -r d3a9b055206c Misc/ACKS --- a/Misc/ACKS Mon Nov 23 23:50:26 2015 +0000 +++ b/Misc/ACKS Tue Nov 24 01:57:44 2015 +0000 @@ -1439,6 +1439,7 @@ Niki W. Waibel Wojtek Walczak Charles Waldman +Myron Walker Richard Walker Larry Wall Kevin Walzer diff -r d3a9b055206c Misc/NEWS --- a/Misc/NEWS Mon Nov 23 23:50:26 2015 +0000 +++ b/Misc/NEWS Tue Nov 24 01:57:44 2015 +0000 @@ -13,6 +13,9 @@ Library ------- +- Issue #25716: Fix memory leak in call_method() and call_maybe(), when + building the argument list failed. Fix by Myron Walker. + - Issue #25663: In the Readline completer, avoid listing duplicate global names, and search the global namespace before searching builtins. diff -r d3a9b055206c Objects/typeobject.c --- a/Objects/typeobject.c Mon Nov 23 23:50:26 2015 +0000 +++ b/Objects/typeobject.c Tue Nov 24 01:57:44 2015 +0000 @@ -1254,8 +1254,10 @@ va_end(va); - if (args == NULL) + if (args == NULL) { + Py_DECREF(func); return NULL; + } assert(PyTuple_Check(args)); retval = PyObject_Call(func, args, NULL); @@ -1292,8 +1294,10 @@ va_end(va); - if (args == NULL) + if (args == NULL) { + Py_DECREF(func); return NULL; + } assert(PyTuple_Check(args)); retval = PyObject_Call(func, args, NULL); @@ -4951,15 +4955,6 @@ #define SLOT1BIN(FUNCNAME, SLOTNAME, OPSTR, ROPSTR) \ SLOT1BINFULL(FUNCNAME, FUNCNAME, SLOTNAME, OPSTR, ROPSTR) -#define SLOT2(FUNCNAME, OPSTR, ARG1TYPE, ARG2TYPE, ARGCODES) \ -static PyObject * \ -FUNCNAME(PyObject *self, ARG1TYPE arg1, ARG2TYPE arg2) \ -{ \ - static PyObject *cache_str; \ - return call_method(self, OPSTR, &cache_str, \ - "(" ARGCODES ")", arg1, arg2); \ -} - static Py_ssize_t slot_sq_length(PyObject *self) {