[issue21641] smtplib leaves open sockets around if SMTPResponseException is raised in __init__

2014-06-03 Thread Senthil Kumaran
Senthil Kumaran added the comment: The first patch was correct and consistent with how other Exceptions were closing the socket. Fixed this and thanks for the patch. -- assignee: -> orsenthil nosy: +orsenthil resolution: -> fixed stage: -> resolved status: open -> closed versions: +P

[issue21641] smtplib leaves open sockets around if SMTPResponseException is raised in __init__

2014-06-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset d5c76646168d by Senthil Kumaran in branch '3.4': Fix issue #21641: Close the socket before raising the SMTPResponseException. Fixes the ResourceWarning in the test run. http://hg.python.org/cpython/rev/d5c76646168d New changeset 7ea84a25d863 by Sen

[issue21641] smtplib leaves open sockets around if SMTPResponseException is raised in __init__

2014-06-03 Thread Claudiu.Popa
Claudiu.Popa added the comment: It's actually better to close the socket in __init__ in this case. -- Added file: http://bugs.python.org/file35466/issue21641.patch ___ Python tracker ___

[issue21641] smtplib leaves open sockets around if SMTPResponseException is raised in __init__

2014-06-02 Thread Claudiu.Popa
New submission from Claudiu.Popa: Hello! I noticed that test_smtplib raises a ResourceWarning, tracking this to this piece of code: self.assertRaises(smtplib.SMTPResponseException, smtplib.SMTP, HOST, self.port, 'localhost', 3) What happens is that `SMTP.getreply` is c

[issue21641] smtplib leaves open sockets around if SMTPResponseException is raised in __init__

2014-06-02 Thread Claudiu.Popa
Claudiu.Popa added the comment: An alternative to this approach would be to catch the error in __init__ and close the socket there. -- ___ Python tracker ___ ___