Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment:

On Mon, Jan 19, 2009 at 2:01 PM, Tarek Ziadé <rep...@bugs.python.org> wrote:
>
> Tarek Ziadé <ziade.ta...@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.

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4972>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to