bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551)
(cherry picked from commit 0523c39e77
)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
parent
eb94e5b3ec
commit
e0fe25be1e
|
@ -0,0 +1 @@
|
||||||
|
Fix a possible reference leak in :func:`itertools.count`.
|
|
@ -4027,6 +4027,7 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
lz = (countobject *)type->tp_alloc(type, 0);
|
lz = (countobject *)type->tp_alloc(type, 0);
|
||||||
if (lz == NULL) {
|
if (lz == NULL) {
|
||||||
Py_XDECREF(long_cnt);
|
Py_XDECREF(long_cnt);
|
||||||
|
Py_DECREF(long_step);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
lz->cnt = cnt;
|
lz->cnt = cnt;
|
||||||
|
|
Loading…
Reference in New Issue