Skip to content

Commit fe866d9

Browse files
committed
unix/moduselect: Properly implement ipoll object iteration.
TODO: There's another issue to care about: poll set being modified during iteration.
1 parent 3ab6aa3 commit fe866d9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

unix/moduselect.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,9 @@ STATIC mp_obj_t poll_iternext(mp_obj_t self_in) {
253253

254254
self->iter_cnt--;
255255

256-
struct pollfd *entries = self->entries;
256+
struct pollfd *entries = self->entries + self->iter_idx;
257257
for (int i = self->iter_idx; i < self->len; i++, entries++) {
258+
self->iter_idx++;
258259
if (entries->revents != 0) {
259260
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->ret_tuple);
260261
// If there's an object stored, return it, otherwise raw fd

0 commit comments

Comments
 (0)