mirror of
https://github.com/python/cpython.git
synced 2025-08-15 06:10:47 +00:00
Replace structure member before decreffing.
This commit is contained in:
parent
4c3d054d3d
commit
880430e2a5
1 changed files with 3 additions and 1 deletions
|
@ -662,6 +662,7 @@ cycle_next(cycleobject *lz)
|
||||||
{
|
{
|
||||||
PyObject *item;
|
PyObject *item;
|
||||||
PyObject *it;
|
PyObject *it;
|
||||||
|
PyObject *tmp;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
item = PyIter_Next(lz->it);
|
item = PyIter_Next(lz->it);
|
||||||
|
@ -681,9 +682,10 @@ cycle_next(cycleobject *lz)
|
||||||
it = PyObject_GetIter(lz->saved);
|
it = PyObject_GetIter(lz->saved);
|
||||||
if (it == NULL)
|
if (it == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_DECREF(lz->it);
|
tmp = lz->it;
|
||||||
lz->it = it;
|
lz->it = it;
|
||||||
lz->firstpass = 1;
|
lz->firstpass = 1;
|
||||||
|
Py_DECREF(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue