changeset: 100839:92947704321c user: Martin Panter date: Sun Apr 03 02:12:54 2016 +0000 files: Lib/ssl.py Lib/test/test_ssl.py Misc/NEWS description: Issue #25951: Fix SSLSocket.sendall() to return None, by Aviv Palivoda diff -r 1b696c744559 -r 92947704321c Lib/ssl.py --- a/Lib/ssl.py Sun Apr 03 01:28:53 2016 +0000 +++ b/Lib/ssl.py Sun Apr 03 02:12:54 2016 +0000 @@ -886,7 +886,6 @@ while (count < amount): v = self.send(data[count:]) count += v - return amount else: return socket.sendall(self, data, flags) diff -r 1b696c744559 -r 92947704321c Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py Sun Apr 03 01:28:53 2016 +0000 +++ b/Lib/test/test_ssl.py Sun Apr 03 02:12:54 2016 +0000 @@ -2709,12 +2709,13 @@ count, addr = s.recvfrom_into(b) return b[:count] - # (name, method, whether to expect success, *args) + # (name, method, expect success?, *args, return value func) send_methods = [ - ('send', s.send, True, []), - ('sendto', s.sendto, False, ["some.address"]), - ('sendall', s.sendall, True, []), + ('send', s.send, True, [], len), + ('sendto', s.sendto, False, ["some.address"], len), + ('sendall', s.sendall, True, [], lambda x: None), ] + # (name, method, whether to expect success, *args) recv_methods = [ ('recv', s.recv, True, []), ('recvfrom', s.recvfrom, False, ["some.address"]), @@ -2723,10 +2724,13 @@ ] data_prefix = "PREFIX_" - for meth_name, send_meth, expect_success, args in send_methods: + for (meth_name, send_meth, expect_success, args, + ret_val_meth) in send_methods: indata = (data_prefix + meth_name).encode('ascii') try: - send_meth(indata, *args) + ret = send_meth(indata, *args) + msg = "sending with {}".format(meth_name) + self.assertEqual(ret, ret_val_meth(indata), msg=msg) outdata = s.read() if outdata != indata.lower(): self.fail( diff -r 1b696c744559 -r 92947704321c Misc/NEWS --- a/Misc/NEWS Sun Apr 03 01:28:53 2016 +0000 +++ b/Misc/NEWS Sun Apr 03 02:12:54 2016 +0000 @@ -237,6 +237,9 @@ Library ------- +- Issue #25951: Change SSLSocket.sendall() to return None, as explicitly + documented for plain socket objects. Patch by Aviv Palivoda. + - Issue #26586: In http.server, respond with "413 Request header fields too large" if there are too many header fields to parse, rather than killing the connection and raising an unhandled exception. Patch by Xiang Zhang.