This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: can raise socket.error
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 2.7, Python 2.6, Python 2.5
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: ggenellina, giampaolo.rodola, kristjan.jonsson, vstinner
Priority: normal Keywords: needs review, patch

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

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/ ;-)
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
Date User Action Args
2022-04-11 14:56:44adminsetgithub: 49179
2009-01-19 10:38:31kristjan.jonssonsetkeywords: patch, patch, needs review
messages: + msg80156
2009-01-15 17:28:13kristjan.jonssonsetstatus: open -> closed
keywords: patch, patch, needs review
resolution: accepted
messages: + msg79904
2009-01-15 00:50:34giampaolo.rodolasetmessages: + msg79883
2009-01-15 00:35:37ggenellinasetnosy: + ggenellina
messages: + msg79882
2009-01-14 11:10:55giampaolo.rodolasetnosy: + giampaolo.rodola
2009-01-13 23:32:22kristjan.jonssonsetkeywords: patch, patch, needs review
messages: + msg79798
2009-01-13 18:49:23vstinnersetkeywords: patch, patch, needs review
nosy: + vstinner
messages: + msg79765
2009-01-13 11:31:16kristjan.jonssoncreate