Message258176
Minor bug introduced while implementing the fix for #7830:
In the case where functools.partial is wrapping another functools.partial instance, both of them providing positional arguments, the value nargs is not freed when the tuple concatenation fails and the constructor raises an Exception/returns NULL. Only nargs has the problem (it's a slice of the args passed to the function); pargs is a borrowed reference so there is no leak there. Admittedly, the odds of failure is incredibly low, but best to fix it on principle.
Code link: https://hg.python.org/cpython/file/5a2692911a43/Modules/_functoolsmodule.c#l77
The simplest fix is to add the explicit DECREF in the error path:
pto->args = PySequence_Concat(pargs, nargs);
if (pto->args == NULL) {
pto->kw = NULL;
Py_DECREF(nargs); // <-- New
Py_DECREF(pto);
return NULL;
}
All other code paths hit a DECREF later on, no other fixes required. I'd submit a proper patch, but I'm on a new machine and I've got a lot of work to get the repos set up again. |
|
Date |
User |
Action |
Args |
2016-01-13 22:24:30 | josh.r | set | recipients:
+ josh.r, belopolsky |
2016-01-13 22:24:30 | josh.r | set | messageid: <1452723870.39.0.274687476417.issue26104@psf.upfronthosting.co.za> |
2016-01-13 22:24:30 | josh.r | link | issue26104 messages |
2016-01-13 22:24:29 | josh.r | create | |
|