]> granicus.if.org Git - python/commitdiff
Fix issue 11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors on...
authorGiampaolo Rodolà <g.rodola@gmail.com>
Thu, 3 Mar 2011 13:57:47 +0000 (13:57 +0000)
committerGiampaolo Rodolà <g.rodola@gmail.com>
Thu, 3 Mar 2011 13:57:47 +0000 (13:57 +0000)
Lib/asyncore.py
Misc/NEWS

index aaa9e7c421fa9278ebc73e66ea446996aa8b61bc..f790c8a01839a3f99b6ec91fc1536b39ef018331 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 ff6ee30d874ca6461e353494722cddf9f097d0a4..64e2d5922900a15e22dff61bebf9f846c37c1cd1 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -52,6 +52,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors
+  on accept(), send() and recv().
+
 - Issue #11377: Deprecate platform.popen() and reimplement it with os.popen().
 
 - Issue #8513: On UNIX, subprocess supports bytes command string.