From: Josiah Carlson Date: Wed, 3 Jun 2009 19:46:21 +0000 (+0000) Subject: This fixes bug 5798 on OS X. X-Git-Tag: v2.7a1~1038 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a810bc736c41eb82fff14f905d0ce35d3f2e5763;p=thirdparty%2FPython%2Fcpython.git This fixes bug 5798 on OS X. This should also fix disconnect behavior cross-platform. --- diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 4f1153b760b6..3672db9f0fd8 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -101,10 +101,16 @@ def readwrite(obj, flags): obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() - if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL): - obj.handle_close() 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: