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 belopolsky
Recipients belopolsky, tarek
Date 2009-01-19.21:21:56
SpamBayes Score 7.5870754e-10
Marked as misclassified No
Message-id <d38f5330901191321o4ccb01bcv3b4dcc12a332b473@mail.gmail.com>
In-reply-to <1232391683.93.0.000703948725121.issue4972@psf.upfronthosting.co.za>
Content
On Mon, Jan 19, 2009 at 2:01 PM, Tarek Ziadé <report@bugs.python.org> wrote:
>
> Tarek Ziadé <ziade.tarek@gmail.com> added the comment:
>
>> What is the rationale for swallowing all socket exceptions except
>> "Connection reset by peer" in __exit__?
>
> I am catching just the error that raises if the connection is closed
> when calling quit()
>

I see. I misread the double negative "except errno NOT equals 54", but
I still don't see the rationale for that exception.  I any case, I
don't think your patch implements that because SMTP transforms socket
errors into SMTPServer* errors in send():

        if self.sock:
            try:
                self.sock.sendall(str)
            except socket.error:
                self.close()
                raise SMTPServerDisconnected('Server not connected')
        else:
            raise SMTPServerDisconnected('please run connect() first')

so you will never see a socket error from quit().

Furthermore, I don't think you should ignore return code from quit():
you should raise an error if it returns anything but 221.
History
Date User Action Args
2009-01-19 21:21:58belopolskysetrecipients: + belopolsky, tarek
2009-01-19 21:21:57belopolskylinkissue4972 messages
2009-01-19 21:21:56belopolskycreate