mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
defdict_reduce(): Plug leaks.
We didn't notice these before because test_defaultdict didn't actually do anything before Georg fixed that earlier today. Neal's next refleak run then showed test_defaultdict leaking 9 references on each run. That's repaired by this checkin.
This commit is contained in:
parent
d17301f95c
commit
5566e96830
1 changed files with 11 additions and 10 deletions
|
@ -1117,7 +1117,7 @@ defdict_copy(defdictobject *dd)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
defdict_reduce(defdictobject *dd)
|
defdict_reduce(defdictobject *dd)
|
||||||
{
|
{
|
||||||
/* __reduce__ must returns a 5-tuple as follows:
|
/* __reduce__ must return a 5-tuple as follows:
|
||||||
|
|
||||||
- factory function
|
- factory function
|
||||||
- tuple of args for the factory function
|
- tuple of args for the factory function
|
||||||
|
@ -1155,6 +1155,7 @@ defdict_reduce(defdictobject *dd)
|
||||||
}
|
}
|
||||||
result = PyTuple_Pack(5, dd->dict.ob_type, args,
|
result = PyTuple_Pack(5, dd->dict.ob_type, args,
|
||||||
Py_None, Py_None, items);
|
Py_None, Py_None, items);
|
||||||
|
Py_DECREF(items);
|
||||||
Py_DECREF(args);
|
Py_DECREF(args);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue