mirror of https://github.com/python/cpython
For safety, replace a tuple entry before decreffing it.
This commit is contained in:
parent
a56f6b6600
commit
4f01f89b8c
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue