Issue 4929: smptlib.py can raise socket.error (original) (raw)

Created on 2009-01-13 11:31 by kristjan.jonsson, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
smtplib.patch kristjan.jonsson,2009-01-13 11:31
Messages (7)
msg79732 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2009-01-13 11:31
the SMPT.getreply() method doesn't check for socket.error when doing its readline() call. We now check for connection reset and others that can occur here and properly close. This is to comply with the documentation that doesn't specify socket.error as part of the exceptions raised.
msg79765 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2009-01-13 18:49
Your patch looks fine but it would be much better with a test in Lib/test/test_smtp.py ;-)
msg79798 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2009-01-13 23:32
If you can offer a suggestion as to how to reliably trigger a WSAECONNRESET error on windows (or its equivalent on unix) I'll be happy to do that.
msg79882 - (view) Author: Gabriel Genellina (ggenellina) Date: 2009-01-15 00:35
On Windows, if you exit a process abnormally (using e.g. os._exit() in Python) while it still has open connections, the other side receives a WSAECONNRESET (error 10054). So, you could write a test case using a dumb server (running as another process) with a very short, predefined sequence of recv/send calls, ending abruptly with os._exit(). On Linux I *think* you would get ECONNRESET, and at least some form of error on other OS's.
msg79883 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2009-01-15 00:50
IMHO I wouldn't test such case. Behaviors between different platform are unpredictable.
msg79904 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2009-01-15 17:28
Submitted as r68618
msg80156 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2009-01-19 10:38
Note, this has been ported to py3k in http://svn.python.org/view? view=rev&rev=68736
History
Date User Action Args
2022-04-11 14:56:44 admin set github: 49179
2009-01-19 10:38:31 kristjan.jonsson set keywords:patch, patch, needs reviewmessages: +
2009-01-15 17:28:13 kristjan.jonsson set status: open -> closedkeywords:patch, patch, needs reviewresolution: acceptedmessages: +
2009-01-15 00:50:34 giampaolo.rodola set messages: +
2009-01-15 00:35:37 ggenellina set nosy: + ggenellinamessages: +
2009-01-14 11:10:55 giampaolo.rodola set nosy: + giampaolo.rodola
2009-01-13 23:32:22 kristjan.jonsson set keywords:patch, patch, needs reviewmessages: +
2009-01-13 18:49:23 vstinner set keywords:patch, patch, needs reviewnosy: + vstinnermessages: +
2009-01-13 11:31:16 kristjan.jonsson create