if (cmp < 0)
return -1;
childpos += ((unsigned)cmp ^ 1); /* increment when cmp==0 */
+ arr = _PyList_ITEMS(heap); /* arr may have changed */
if (endpos != PyList_GET_SIZE(heap)) {
PyErr_SetString(PyExc_RuntimeError,
"list changed size during iteration");
}
}
/* Move the smaller child up. */
- arr = _PyList_ITEMS(heap);
tmp1 = arr[childpos];
tmp2 = arr[pos];
arr[childpos] = tmp2;
if (cmp < 0)
return -1;
childpos += ((unsigned)cmp ^ 1); /* increment when cmp==0 */
+ arr = _PyList_ITEMS(heap); /* arr may have changed */
if (endpos != PyList_GET_SIZE(heap)) {
PyErr_SetString(PyExc_RuntimeError,
"list changed size during iteration");
}
}
/* Move the smaller child up. */
- arr = _PyList_ITEMS(heap);
tmp1 = arr[childpos];
tmp2 = arr[pos];
arr[childpos] = tmp2;