Commit 4d67f032 authored by Raymond Hettinger's avatar Raymond Hettinger

For safety, replace a tuple entry before decreffing it.

parent 7807e619
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment