Skip to content

Commit c0dce6a

Browse files
miss-islingtonZackerySpytz
authored andcommitted
bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551) (GH-12554)
(cherry picked from commit 0523c39) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
1 parent bd96393 commit c0dce6a

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a possible reference leak in :func:`itertools.count`.

Modules/itertoolsmodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3321,6 +3321,7 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
33213321
lz = (countobject *)type->tp_alloc(type, 0);
33223322
if (lz == NULL) {
33233323
Py_XDECREF(long_cnt);
3324+
Py_DECREF(long_step);
33243325
return NULL;
33253326
}
33263327
lz->cnt = cnt;

0 commit comments

Comments
 (0)