classification
Title: SSLSocket.sendall() does not return None on success like socket.sendall()
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ProgVal, alex, christian.heimes, dstufft, giampaolo.rodola, janssen, martin.panter, palaviv, pitrou, python-dev
Priority: normal Keywords: patch

Created on 2015-12-25 14:45 by ProgVal, last changed 2016-04-03 03:58 by martin.panter. This issue is now closed.

Files
File name Uploaded Description Edit
25951.patch palaviv, 2016-03-24 18:01 review
25951-2.patch palaviv, 2016-03-25 08:57 review
Messages (7)
msg256992 - (view) Author: ProgVal (ProgVal) Date: 2015-12-25 14:45
socket.sendall() returns None if it succeeded <https://docs.python.org/3/library/socket.html#socket.socket.sendall>
SSLSocket.sendall() is said to have the same behavior as socket.sendall(), besides not allowing flags <https://docs.python.org/3/library/ssl.html#ssl.SSLSocket>

However, SSLSocket.sendall() returns the amount of bytes written on success.
msg262370 - (view) Author: Aviv Palivoda (palaviv) * Date: 2016-03-24 18:01
Changed SSLSocket.sendall() to return None. Also added a check of the return value of the SSLSocket.send(), SSLSocket.sendall() in the tests.
msg262388 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-03-25 00:04
Agreed that the documentation and implementation should match. But this seems like a rather low-priority bug. What use case relies on the return value being None?

If there is no immediate need for this change, it might be safer to just make it in 3.6, to minimize compatibility problems. But if it is fixed in 3.5 it should also be fixed in 2.7.

I left some suggestions to simplify the code.
msg262409 - (view) Author: Aviv Palivoda (palaviv) * Date: 2016-03-25 08:57
Thanks for the review.
I don't have any use cases for this change. I just saw this issue while looking for something else and thought I will give it a try.
msg262479 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-03-26 01:02
Thanks for your work Aviv. This version looks good to me.
msg262810 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-04-03 02:38
New changeset 92947704321c by Martin Panter in branch 'default':
Issue #25951: Fix SSLSocket.sendall() to return None, by Aviv Palivoda
https://hg.python.org/cpython/rev/92947704321c
msg262812 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-04-03 03:58
I made some simple tweaks to avoid long lines.
History
Date User Action Args
2016-04-03 03:58:59martin.pantersetstatus: open -> closed
resolution: fixed
messages: + msg262812

stage: patch review -> resolved
2016-04-03 02:38:09python-devsetnosy: + python-dev
messages: + msg262810
2016-03-26 01:02:51martin.pantersetmessages: + msg262479
versions: - Python 3.5
2016-03-25 08:57:24palavivsetfiles: + 25951-2.patch

messages: + msg262409
2016-03-25 00:04:13martin.pantersetnosy: + martin.panter

messages: + msg262388
stage: patch review
2016-03-24 18:01:31palavivsetfiles: + 25951.patch

nosy: + palaviv
messages: + msg262370

keywords: + patch
2015-12-25 15:00:43SilentGhostsetnosy: + janssen, pitrou, giampaolo.rodola, christian.heimes, alex, dstufft

type: behavior
versions: + Python 3.5, Python 3.6, - Python 3.4
2015-12-25 14:45:15ProgValcreate