mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Merge #12973 itertools fix.
This commit is contained in:
commit
a61b053e61
2 changed files with 6 additions and 4 deletions
|
@ -1234,7 +1234,9 @@ islice_next(isliceobject *lz)
|
|||
return NULL;
|
||||
lz->cnt++;
|
||||
oldnext = lz->next;
|
||||
lz->next += lz->step;
|
||||
/* The (size_t) cast below avoids the danger of undefined
|
||||
behaviour from signed integer overflow. */
|
||||
lz->next += (size_t)lz->step;
|
||||
if (lz->next < oldnext || (stop != -1 && lz->next > stop))
|
||||
lz->next = stop;
|
||||
return item;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue