summaryrefslogtreecommitdiffstats
path: root/Lib/asynchat.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-24 17:15:00 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-07-24 17:15:00 (GMT)
commitfe9ebe4f4ff848cda1d4a5e398354b3be3fb984e (patch)
tree60aa28381ed704f4842db1c365cea223acbb0a1b /Lib/asynchat.py
parent186f66540dfcce1abec59d87d24e944c7987a53c (diff)
downloadcpython-fe9ebe4f4ff848cda1d4a5e398354b3be3fb984e.zip
cpython-fe9ebe4f4ff848cda1d4a5e398354b3be3fb984e.tar.gz
cpython-fe9ebe4f4ff848cda1d4a5e398354b3be3fb984e.tar.bz2
Issue #16133: The asynchat.async_chat.handle_read() method now ignores
socket.error() exceptions with blocking I/O errors: EAGAIN, EALREADY, EINPROGRESS, or EWOULDBLOCK. Initial patch written by Xavier de Gaye.
Diffstat (limited to 'Lib/asynchat.py')
-rw-r--r--Lib/asynchat.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/asynchat.py b/Lib/asynchat.py
index 911833d..57459a0 100644
--- a/Lib/asynchat.py
+++ b/Lib/asynchat.py
@@ -46,12 +46,17 @@ method) up to the terminator, and then control will be returned to
you - by calling your self.found_terminator() method.
"""
-import socket
import asyncore
+import errno
+import socket
from collections import deque
from sys import py3kwarning
from warnings import filterwarnings, catch_warnings
+_BLOCKING_IO_ERRORS = (errno.EAGAIN, errno.EALREADY, errno.EINPROGRESS,
+ errno.EWOULDBLOCK)
+
+
class async_chat (asyncore.dispatcher):
"""This is an abstract class. You must derive from this class, and add
the two methods collect_incoming_data() and found_terminator()"""
@@ -109,6 +114,8 @@ class async_chat (asyncore.dispatcher):
try:
data = self.recv (self.ac_in_buffer_size)
except socket.error, why:
+ if why.args[0] in _BLOCKING_IO_ERRORS:
+ return
self.handle_error()
return