[issue4142] smtplib doesn't clear helo/ehlo flags on quit
Martin v. Löwis
report at bugs.python.org
Sun Feb 15 19:46:30 CET 2009
Martin v. Löwis <martin at v.loewis.de> added the comment:
IIUC, the bug only occurs if you use the same SMTP object for multiple
connections. I would claim that this is a bug in the application: SMTP
objects are not designed to be used for multiple connections. You need
to create a new one for each connection.
If you want to extend the SMTP class to work for multiple connections,
the provided patch is incorrect. Resetting the attributes should not be
done in .connect() (i.e. for the new connection), but in .close() (i.e.
when shutting down the previous connection). Furthermore, it should not
only reset the two response attributes, but all per-connection
attributes (which includes e.g. esmtp_features), and a test should be
provided that, after close, only known "good" attributes remain set on
the object (e.g. debuglevel).
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list