mirror of
https://github.com/python/cpython.git
synced 2025-09-18 22:50:26 +00:00
Fix issue 11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors on accept(), recv() and send().
This commit is contained in:
parent
1dfd380306
commit
1bc75c6cee
2 changed files with 8 additions and 4 deletions
|
@ -54,9 +54,10 @@ import warnings
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, \
|
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:
|
try:
|
||||||
socket_map
|
socket_map
|
||||||
|
@ -111,7 +112,7 @@ def readwrite(obj, flags):
|
||||||
if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
|
if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
|
||||||
obj.handle_close()
|
obj.handle_close()
|
||||||
except socket.error as e:
|
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()
|
obj.handle_error()
|
||||||
else:
|
else:
|
||||||
obj.handle_close()
|
obj.handle_close()
|
||||||
|
@ -355,7 +356,7 @@ class dispatcher:
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return None
|
return None
|
||||||
except socket.error as why:
|
except socket.error as why:
|
||||||
if why.args[0] in (EWOULDBLOCK, ECONNABORTED):
|
if why.args[0] in (EWOULDBLOCK, ECONNABORTED, EAGAIN):
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -52,6 +52,9 @@ Core and Builtins
|
||||||
Library
|
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 #11377: Deprecate platform.popen() and reimplement it with os.popen().
|
||||||
|
|
||||||
- Issue #8513: On UNIX, subprocess supports bytes command string.
|
- Issue #8513: On UNIX, subprocess supports bytes command string.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue