diff options
-rw-r--r-- | Lib/asyncore.py | 8 | ||||
-rw-r--r-- | Lib/test/test_asyncore.py | 13 | ||||
-rw-r--r-- | Misc/ACKS | 2 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
4 files changed, 25 insertions, 1 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 3e3907eee8..c23c8aa3fe 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -607,6 +607,14 @@ if os.name == 'posix': 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 diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index c352c396b6..6217334029 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -428,6 +428,19 @@ class FileWrapperTest(unittest.TestCase): w.close() self.assertEqual(file(TESTFN).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): @@ -438,8 +438,8 @@ Ivan Krstić Andrew Kuchling Vladimir Kushnir Cameron Laird -Tino Lange Łukasz Langa +Tino Lange Andrew Langmead Detlef Lannert Soren Larsen @@ -24,6 +24,8 @@ Core and Builtins Library ------- +- Issue #9354: Provide getsockopt() in asyncore's file_wrapper. + - Issue #4108: In urllib.robotparser, if there are multiple 'User-agent: *' entries, consider the first one. @@ -951,6 +953,7 @@ Core and Builtins Library ------- + - Issue #1555570: email no longer inserts extra blank lines when a \r\n combo crosses an 8192 byte boundary. |