summaryrefslogtreecommitdiffstats
path: root/Modules/itertoolsmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r--Modules/itertoolsmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 4dca054..68e176f 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -1591,6 +1591,7 @@ izip_next(izipobject *lz)
PyObject *result = lz->result;
PyObject *it;
PyObject *item;
+ PyObject *olditem;
if (tuplesize == 0)
return NULL;
@@ -1604,8 +1605,9 @@ izip_next(izipobject *lz)
Py_DECREF(result);
return NULL;
}
- Py_DECREF(PyTuple_GET_ITEM(result, i));
+ olditem = PyTuple_GET_ITEM(result, i);
PyTuple_SET_ITEM(result, i, item);
+ Py_DECREF(olditem);
}
} else {
result = PyTuple_New(tuplesize);