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 josiahcarlson
Recipients MrJean1, alanmcintyre, donmez, facundobatista, giampaolo.rodola, josiahcarlson, mark.dickinson, r.david.murray
Date 2009-05-08.20:57:49
SpamBayes Score 0.0007025106
Marked as misclassified No
Message-id <1241816270.56.0.297536045965.issue5798@psf.upfronthosting.co.za>
In-reply-to
Content
Here's an option that doesn't use .connected, which some people have 
expressed distaste for.

def readwrite(obj, flags):
    try:
        if flags & select.POLLIN:
            obj.handle_read_event()
        if flags & select.POLLOUT:
            obj.handle_write_event()
        if flags & select.POLLPRI:
            obj.handle_expt_event()
        if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
            obj.handle_close()
    except socket.error, e:
        if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN, 
ECONNABORTED):
            obj.handle_error()
        else:
            obj.handle_close()
    except _reraised_exceptions:
        raise
    except:
        obj.handle_error()

It works on OS X and should work just as well on other platforms.
History
Date User Action Args
2009-05-08 20:57:50josiahcarlsonsetrecipients: + josiahcarlson, facundobatista, mark.dickinson, alanmcintyre, giampaolo.rodola, donmez, MrJean1, r.david.murray
2009-05-08 20:57:50josiahcarlsonsetmessageid: <1241816270.56.0.297536045965.issue5798@psf.upfronthosting.co.za>
2009-05-08 20:57:49josiahcarlsonlinkissue5798 messages
2009-05-08 20:57:49josiahcarlsoncreate