diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2018-09-28 21:49:42 +0300 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-10-05 16:56:43 +1000 |
commit | b9bad7ff927448fc0b4c881bf37fea632958fb7a (patch) | |
tree | 4466f0b5677f0a471ff6a6df542f34f9a9b93ee8 | |
parent | cb66b75692225914bacc1b5f4e32967d37f9cf9d (diff) | |
download | micropython-b9bad7ff927448fc0b4c881bf37fea632958fb7a.tar.gz micropython-b9bad7ff927448fc0b4c881bf37fea632958fb7a.zip |
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.
-rw-r--r-- | ports/unix/moduselect.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ports/unix/moduselect.c b/ports/unix/moduselect.c index 4fa8d3ae80..a95663e31f 100644 --- a/ports/unix/moduselect.c +++ b/ports/unix/moduselect.c @@ -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); |