Skip to content

Commit 0523c39

Browse files
ZackerySpytzserhiy-storchaka
authored andcommitted
bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551)
1 parent 3e700e4 commit 0523c39

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
@@ -4089,6 +4089,7 @@ itertools_count_impl(PyTypeObject *type, PyObject *long_cnt,
40894089
lz = (countobject *)type->tp_alloc(type, 0);
40904090
if (lz == NULL) {
40914091
Py_XDECREF(long_cnt);
4092+
Py_DECREF(long_step);
40924093
return NULL;
40934094
}
40944095
lz->cnt = cnt;

0 commit comments

Comments
 (0)