summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/asyncore.py10
-rw-r--r--Misc/NEWS3
2 files changed, 10 insertions, 3 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index 861495d..00464a9 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -52,7 +52,11 @@ import sys
import time
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
@@ -107,7 +111,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()
@@ -349,7 +353,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
diff --git a/Misc/NEWS b/Misc/NEWS
index d241c2e..ed3f72a 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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 #10276: Fix the results of zlib.crc32() and zlib.adler32() on buffers
larger than 4GB. Patch by Nadeem Vawda.