Skip to content

Commit 65daaee

Browse files
committed
fix
1 parent 2037e3d commit 65daaee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Modules/itertoolsmodule.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3634,9 +3634,10 @@ repeat_next(PyObject *op)
36343634
if (cnt == 0) {
36353635
return NULL;
36363636
}
3637-
cnt--;
3638-
assert(cnt >=0);
3639-
FT_ATOMIC_STORE_SSIZE_RELAXED(ro->cnt, cnt);
3637+
if (cnt > 0) {
3638+
cnt--;
3639+
FT_ATOMIC_STORE_SSIZE_RELAXED(ro->cnt, cnt);
3640+
}
36403641
return Py_NewRef(ro->element);
36413642
}
36423643

0 commit comments

Comments
 (0)