]> granicus.if.org Git - python/commitdiff
Merged revisions 88722 via svnmerge from
authorGiampaolo Rodolà <g.rodola@gmail.com>
Thu, 3 Mar 2011 13:59:28 +0000 (13:59 +0000)
committerGiampaolo Rodolà <g.rodola@gmail.com>
Thu, 3 Mar 2011 13:59:28 +0000 (13:59 +0000)
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().
........

Lib/asyncore.py
Misc/NEWS

index a277bddc86a2e3180a51ee3fd2481cf51618104b..0ad78db714d040e57de95be269038d467c597612 100644 (file)
@@ -54,9 +54,10 @@ 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, errorcode
 
-_DISCONNECTED = frozenset((ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED))
+_DISCONNECTED = frozenset((ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE,
+                           EBADF))
 
 try:
     socket_map
@@ -111,7 +112,7 @@ def readwrite(obj, flags):
         if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
             obj.handle_close()
     except socket.error as 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()
@@ -355,7 +356,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
index 1bd81768c96a38d856ea8f532317355d46f0e3b3..d5512f26c0c8ad0edae39a718a71027783093888 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -28,6 +28,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.