Index: Lib/asyncore.py =================================================================== --- Lib/asyncore.py (revision 83186) +++ Lib/asyncore.py (working copy) @@ -606,6 +606,14 @@ def send(self, *args): return os.write(self.fd, *args) + + def getsockopt(self, level, optname, buflen=None): + if (level == socket.SOL_SOCKET and + optname == socket.SO_ERROR and + not buflen): + return 0 + raise NotImplementedError("Only asyncore specific behaviour " + "implemented.") read = recv write = send Index: Lib/test/test_asyncore.py =================================================================== --- Lib/test/test_asyncore.py (revision 83186) +++ Lib/test/test_asyncore.py (working copy) @@ -428,7 +428,20 @@ w.close() self.assertEqual(open(TESTFN, 'rb').read(), self.d + d1 + d2) + @unittest.skipUnless(hasattr(asyncore, 'file_dispatcher'), + 'asyncore.file_dispatcher required') + def test_dispatcher(self): + fd = os.open(TESTFN, os.O_RDONLY) + data = [] + class FileDispatcher(asyncore.file_dispatcher): + def handle_read(self): + data.append(self.recv(29)) + s = FileDispatcher(fd) + os.close(fd) + asyncore.loop(timeout=0.01, use_poll=True, count=2) + self.assertEqual(b"".join(data), self.d) + class BaseTestHandler(asyncore.dispatcher): def __init__(self, sock=None):