Skip to content

Commit e0fe25b

Browse files
bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551)
(cherry picked from commit 0523c39) Co-authored-by: Zackery Spytz <[email protected]>
1 parent eb94e5b commit e0fe25b

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
@@ -4027,6 +4027,7 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
40274027
lz = (countobject *)type->tp_alloc(type, 0);
40284028
if (lz == NULL) {
40294029
Py_XDECREF(long_cnt);
4030+
Py_DECREF(long_step);
40304031
return NULL;
40314032
}
40324033
lz->cnt = cnt;

0 commit comments

Comments
 (0)