empty bytes object implies that the channel has been closed from the
other end.
+ Note that :meth:`recv` may raise :exc:`BlockingIOError` , even though
+ :func:`select.select` or :func:`select.poll` has reported the socket
+ ready for reading.
+
.. method:: listen(backlog)
import asynchat
import asyncore
+import errno
import socket
import sys
import time
import unittest
+import unittest.mock
try:
import threading
except ImportError:
usepoll = True
+class TestAsynchatMocked(unittest.TestCase):
+ def test_blockingioerror(self):
+ # Issue #16133: handle_read() must ignore BlockingIOError
+ sock = unittest.mock.Mock()
+ sock.recv.side_effect = BlockingIOError(errno.EAGAIN)
+
+ dispatcher = asynchat.async_chat()
+ dispatcher.set_socket(sock)
+ self.addCleanup(dispatcher.del_channel)
+
+ with unittest.mock.patch.object(dispatcher, 'handle_error') as error:
+ dispatcher.handle_read()
+ self.assertFalse(error.called)
+
+
class TestHelperFunctions(unittest.TestCase):
def test_find_prefix_at_end(self):
self.assertEqual(asynchat.find_prefix_at_end("qwerty\r", "\r\n"), 1)
Library
-------
+- Issue #16133: The asynchat.async_chat.handle_read() method now ignores
+ BlockingIOError exceptions.
+
- Issue #19884: readline: Disable the meta modifier key if stdout is not
a terminal to not write the ANSI sequence "\033[1034h" into stdout. This
sequence is used on some terminal (ex: TERM=xterm-256color") to enable