diff options
author | Giampaolo RodolĂ <g.rodola@gmail.com> | 2011-03-03 14:17:51 (GMT) |
---|---|---|
committer | Giampaolo RodolĂ <g.rodola@gmail.com> | 2011-03-03 14:17:51 (GMT) |
commit | d65224f33960959a42f526c3b78caa065d006b55 (patch) | |
tree | 4dfaa6094f8ddba74cbca7ea4ae6fc51f6e83267 | |
parent | 2262766de23d980de1edd8603a299ee6b5dcde70 (diff) | |
download | cpython-d65224f33960959a42f526c3b78caa065d006b55.zip cpython-d65224f33960959a42f526c3b78caa065d006b55.tar.gz cpython-d65224f33960959a42f526c3b78caa065d006b55.tar.bz2 |
Merged revisions 88722 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r88722 | giampaolo.rodola | 2011-03-03 14:57:47 +0100 (gio, 03 mar 2011) | 1 line
Fix issue 11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors on accept(), recv() and send().
........
-rw-r--r-- | Lib/asyncore.py | 14 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
2 files changed, 12 insertions, 5 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py index daf6644..1a623db 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -54,7 +54,11 @@ import warnings import os from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, \ - ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, errorcode + ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, \ + errorcode + +_DISCONNECTED = frozenset((ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE, + EBADF)) try: socket_map @@ -109,7 +113,7 @@ def readwrite(obj, flags): 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): + if e.args[0] not in _DISCONNECTED: obj.handle_error() else: obj.handle_close() @@ -353,7 +357,7 @@ class dispatcher: except TypeError: return None except socket.error as why: - if why.args[0] in (EWOULDBLOCK, ECONNABORTED): + if why.args[0] in (EWOULDBLOCK, ECONNABORTED, EAGAIN): return None else: raise @@ -367,7 +371,7 @@ class dispatcher: except socket.error, why: if why.args[0] == EWOULDBLOCK: return 0 - elif why.args[0] in (ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED): + elif why.args[0] in _DISCONNECTED: self.handle_close() return 0 else: @@ -385,7 +389,7 @@ class dispatcher: return data except socket.error, why: # winsock sometimes throws ENOTCONN - if why.args[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED]: + if why.args[0] in _DISCONNECTED: self.handle_close() return '' else: @@ -37,6 +37,9 @@ Core and Builtins Library ------- +- Issue #11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors + on accept(), send() and recv(). + - Issue #11326: Add the missing connect_ex() implementation for SSL sockets, and make it work for non-blocking connects. |