This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alexer
Recipients ajaksu2, akuchling, alexer, anadelonbrin, brett.cannon, giampaolo.rodola, gregory.p.smith, josiahcarlson, tim.peters
Date 2009-03-31.12:37:36
SpamBayes Score 2.7755576e-16
Marked as misclassified No
Message-id <1238503058.31.0.233097368088.issue1161031@psf.upfronthosting.co.za>
In-reply-to
Content
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()
History
Date User Action Args
2009-03-31 12:37:38alexersetrecipients: + alexer, tim.peters, akuchling, brett.cannon, gregory.p.smith, anadelonbrin, josiahcarlson, giampaolo.rodola, ajaksu2
2009-03-31 12:37:38alexersetmessageid: <1238503058.31.0.233097368088.issue1161031@psf.upfronthosting.co.za>
2009-03-31 12:37:37alexerlinkissue1161031 messages
2009-03-31 12:37:36alexercreate