mirror of https://github.com/python/cpython.git
GCC was complaining that 'value' in dictiter_iternextvalue() wasn't
necessarily always set before used. Between Tim, Armin & me we couldn't prove GCC wrong, so we decided to fix the algorithm. This version is Armin's.
This commit is contained in:
parent
fe703e0650
commit
09240f65f8
|
@ -2148,15 +2148,16 @@ static PyObject *dictiter_iternextvalue(dictiterobject *di)
|
||||||
}
|
}
|
||||||
|
|
||||||
i = di->di_pos;
|
i = di->di_pos;
|
||||||
if (i < 0)
|
mask = d->ma_mask;
|
||||||
|
if (i < 0 || i > mask)
|
||||||
goto fail;
|
goto fail;
|
||||||
ep = d->ma_table;
|
ep = d->ma_table;
|
||||||
mask = d->ma_mask;
|
while ((value=ep[i].me_value) == NULL) {
|
||||||
while (i <= mask && (value=ep[i].me_value) == NULL)
|
|
||||||
i++;
|
i++;
|
||||||
|
if (i > mask)
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
di->di_pos = i+1;
|
di->di_pos = i+1;
|
||||||
if (i > mask)
|
|
||||||
goto fail;
|
|
||||||
di->len--;
|
di->len--;
|
||||||
Py_INCREF(value);
|
Py_INCREF(value);
|
||||||
return value;
|
return value;
|
||||||
|
|
Loading…
Reference in New Issue