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.

Author matrixise
Recipients Romuald, matrixise
Date 2018-01-26.16:10:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20180126160201.GA5267@xps>
In-reply-to <1516980686.04.0.467229070634.issue32680@psf.upfronthosting.co.za>
Content
You are right, but...

if there is an exception in the connect method before the init of
self.sock, the sock attribute will not exist and in this case, and only
in this case, there will be an exception in the close method.

your code will work fine if you use a try/finally but not in the case
where we use the with statement, for example.

with SMTP('myhost') as smtp:
   smtp.do_something()

If there is an exception in the __init__ of SMTP and self.sock is not
initialized -> traceback.
History
Date User Action Args
2018-01-26 16:10:58matrixisesetrecipients: + matrixise, Romuald
2018-01-26 16:10:58matrixiselinkissue32680 messages
2018-01-26 16:10:58matrixisecreate