Aleksi Torhamo <alexerion+pythonb...@gmail.com> added the comment: Please correct me, if i'm wrong, but this seems to be a real bug, caused by people thinking that handle_expt is something like handle_error.
As Tony stated, the docs say that handle_expt is called when out-of-band data arrives, and that is - i think - correct. poll, which uses select, calls _exception -> handle_expt_event with fds from the third set of select. The manpage select_tut(2) has example code, which has a comment indicating that the third set is supposed to contain sockets with OOB data. poll2, however, calls readwrite, which calls handle_expt_event on error conditions. Furthermore, it calls handle_read_event on POLLPRI, which (according to the manpage of poll(2)) is supposed to indicate OOB data when using poll. Since handle_error is intended for python exceptions, currently there is no proper method to call on POLLERR and POLLNVAL, unless handle_close is called. With POLLNVAL, handle_close seems like the correct thing to do (manpage says it indicates that fd is not open.) With POLLERR, i have no idea. Manpage says "Error condition", but from that, it's hard to say whether it refers to a temporary error condition or not. So, i think readwrite should look something like this: (Assuming POLLERR -> handle_close, otherwise a new handler would probably have to be introduced) if flags & select.POLLPRI: obj.handle_expt_event() if flags & select.POLLIN: obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() if flags & (select.POLLERR | select.POLLNVAL | select.POLLHUP): obj.handle_close() ---------- nosy: +alexer _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1161031> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com