From 5fab03fd1565f4cd644ea2ab007876084dabfb8d Mon Sep 17 00:00:00 2001 From: Nick Coghlan Date: Tue, 23 Aug 2011 22:26:44 +1000 Subject: Remove the SSLSocket versions of sendmsg/recvmsg due to lack of proper tests and documentation in conjunction with lack of any known use cases (see issue #6560 for details) --- Lib/ssl.py | 24 ------------------------ Lib/test/test_ssl.py | 16 ---------------- 2 files changed, 40 deletions(-) diff --git a/Lib/ssl.py b/Lib/ssl.py index 1b7416e..914e749 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -355,14 +355,6 @@ class SSLSocket(socket): else: return socket.sendto(self, data, flags_or_addr, addr) - def sendmsg(self, *args, **kwargs): - self._checkClosed() - if self._sslobj: - raise ValueError("sendmsg not allowed on instances of %s" % - self.__class__) - else: - return socket.sendmsg(self, *args, **kwargs) - def sendall(self, data, flags=0): self._checkClosed() if self._sslobj: @@ -421,22 +413,6 @@ class SSLSocket(socket): else: return socket.recvfrom_into(self, buffer, nbytes, flags) - def recvmsg(self, *args, **kwargs): - self._checkClosed() - if self._sslobj: - raise ValueError("recvmsg not allowed on instances of %s" % - self.__class__) - else: - return socket.recvmsg(self, *args, **kwargs) - - def recvmsg_into(self, *args, **kwargs): - self._checkClosed() - if self._sslobj: - raise ValueError("recvmsg_into not allowed on instances of %s" % - self.__class__) - else: - return socket.recvmsg_into(self, *args, **kwargs) - def pending(self): self._checkClosed() if self._sslobj: diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 1d26c11..f3f0c54 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -186,11 +186,8 @@ class BasicSocketTests(unittest.TestCase): self.assertRaises(socket.error, ss.recv_into, bytearray(b'x')) self.assertRaises(socket.error, ss.recvfrom, 1) self.assertRaises(socket.error, ss.recvfrom_into, bytearray(b'x'), 1) - self.assertRaises(socket.error, ss.recvmsg, 1) - self.assertRaises(socket.error, ss.recvmsg_into, [bytearray(b'x')]) self.assertRaises(socket.error, ss.send, b'x') self.assertRaises(socket.error, ss.sendto, b'x', ('0.0.0.0', 0)) - self.assertRaises(socket.error, ss.sendmsg, [b'x']) def test_timeout(self): # Issue #8524: when creating an SSL socket, the timeout of the @@ -1523,30 +1520,17 @@ else: count, addr = s.recvfrom_into(b) return b[:count] - def _recvmsg(*args, **kwargs): - return s.recvmsg(*args, **kwargs)[0] - - def _recvmsg_into(bufsize, *args, **kwargs): - b = bytearray(bufsize) - return bytes(b[:s.recvmsg_into([b], *args, **kwargs)[0]]) - - def _sendmsg(msg, *args, **kwargs): - return s.sendmsg([msg]) - # (name, method, whether to expect success, *args) send_methods = [ ('send', s.send, True, []), ('sendto', s.sendto, False, ["some.address"]), - ('sendmsg', _sendmsg, False, []), ('sendall', s.sendall, True, []), ] recv_methods = [ ('recv', s.recv, True, []), ('recvfrom', s.recvfrom, False, ["some.address"]), - ('recvmsg', _recvmsg, False, [100]), ('recv_into', _recv_into, True, []), ('recvfrom_into', _recvfrom_into, False, []), - ('recvmsg_into', _recvmsg_into, False, [100]), ] data_prefix = "PREFIX_" -- cgit v0.12