Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 880430e

Browse files
committed
Replace structure member before decreffing.
1 parent 4c3d054 commit 880430e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Modules/itertoolsmodule.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ cycle_next(cycleobject *lz)
662662
{
663663
PyObject *item;
664664
PyObject *it;
665+
PyObject *tmp;
665666

666667
while (1) {
667668
item = PyIter_Next(lz->it);
@@ -681,9 +682,10 @@ cycle_next(cycleobject *lz)
681682
it = PyObject_GetIter(lz->saved);
682683
if (it == NULL)
683684
return NULL;
684-
Py_DECREF(lz->it);
685+
tmp = lz->it;
685686
lz->it = it;
686687
lz->firstpass = 1;
688+
Py_DECREF(tmp);
687689
}
688690
}
689691

0 commit comments

Comments
 (0)