We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6492f2f commit 443404eCopy full SHA for 443404e
Modules/itertoolsmodule.c
@@ -1643,8 +1643,9 @@ islice_next(PyObject *op)
1643
oldnext = FT_ATOMIC_LOAD_SSIZE_RELAXED(lz->next);
1644
/* The (size_t) cast below avoids the danger of undefined
1645
behaviour from signed integer overflow. */
1646
- FT_ATOMIC_STORE_SSIZE_RELAXED(lz->next, oldnext + (size_t)lz->step);
1647
- if (lz->next < oldnext || (stop != -1 && lz->next > stop)) {
+ Py_ssize_t new_next = oldnext + (size_t)lz->step
+ FT_ATOMIC_STORE_SSIZE_RELAXED(lz->next, new_next);
1648
+ if (new_next < oldnext || (stop != -1 && new_next > stop)) {
1649
FT_ATOMIC_STORE_SSIZE_RELAXED(lz->next, stop);
1650
}
1651
return item;
0 commit comments