mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
For safety, replace a tuple entry before decreffing it.
This commit is contained in:
parent
a56f6b6600
commit
4f01f89b8c
1 changed files with 3 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue