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