summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiampaolo RodolĂ  <g.rodola@gmail.com>2011-03-03 13:57:47 (GMT)
committerGiampaolo RodolĂ  <g.rodola@gmail.com>2011-03-03 13:57:47 (GMT)
commit1bc75c6ceebb3dd1488fce259fc05958e58c0c3c (patch)
treed4018899e8c5fec0ca98027d5d332232f598dad4
parent1dfd3803064f2ee4b6e0bae3c60ca39e5f3919ca (diff)
downloadcpython-1bc75c6ceebb3dd1488fce259fc05958e58c0c3c.zip
cpython-1bc75c6ceebb3dd1488fce259fc05958e58c0c3c.tar.gz
cpython-1bc75c6ceebb3dd1488fce259fc05958e58c0c3c.tar.bz2
Fix issue 11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors on accept(), recv() and send().
-rw-r--r--Lib/asyncore.py9
-rw-r--r--Misc/NEWS3
2 files changed, 8 insertions, 4 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index aaa9e7c..f790c8a 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -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
diff --git a/Misc/NEWS b/Misc/NEWS
index ff6ee30..64e2d59 100644
--- 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.