unix/moduselect: Raise OSError(ENOENT) if obj to modify is not in poller
Previously, the function silently succeeded. The new behavior is consistent
with both baremetal uselect implementation and CPython 3.
@@ -158,13 +158,13 @@ STATIC mp_obj_t poll_modify(mp_obj_t self_in, mp_obj_t obj_in, mp_obj_t eventmas
for (int i = self->len - 1; i >= 0; i--) {
if (entries->fd == fd) {
entries->events = mp_obj_get_int(eventmask_in);
- break;
+ return mp_const_none;
}
entries++;
}
- // TODO raise KeyError if obj didn't exist in map
- return mp_const_none;
+ // obj doesn't exist in poller
+ mp_raise_OSError(MP_ENOENT);
}
MP_DEFINE_CONST_FUN_OBJ_3(poll_modify_obj, poll_modify);
