File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,14 @@ siftup(PyListObject *heap, Py_ssize_t pos)
7878 if (cmp < 0 )
7979 return -1 ;
8080 childpos += ((unsigned )cmp ^ 1 ); /* increment when cmp==0 */
81+ arr = _PyList_ITEMS (heap ); /* arr may have changed */
8182 if (endpos != PyList_GET_SIZE (heap )) {
8283 PyErr_SetString (PyExc_RuntimeError ,
8384 "list changed size during iteration" );
8485 return -1 ;
8586 }
8687 }
8788 /* Move the smaller child up. */
88- arr = _PyList_ITEMS (heap );
8989 tmp1 = arr [childpos ];
9090 tmp2 = arr [pos ];
9191 arr [childpos ] = tmp2 ;
@@ -432,14 +432,14 @@ siftup_max(PyListObject *heap, Py_ssize_t pos)
432432 if (cmp < 0 )
433433 return -1 ;
434434 childpos += ((unsigned )cmp ^ 1 ); /* increment when cmp==0 */
435+ arr = _PyList_ITEMS (heap ); /* arr may have changed */
435436 if (endpos != PyList_GET_SIZE (heap )) {
436437 PyErr_SetString (PyExc_RuntimeError ,
437438 "list changed size during iteration" );
438439 return -1 ;
439440 }
440441 }
441442 /* Move the smaller child up. */
442- arr = _PyList_ITEMS (heap );
443443 tmp1 = arr [childpos ];
444444 tmp2 = arr [pos ];
445445 arr [childpos ] = tmp2 ;
You can’t perform that action at this time.
0 commit comments