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 catalin.iacob
Recipients catalin.iacob, giampaolo.rodola, janssen, kasun, pitrou, sijinjoseph
Date 2011-05-28.19:39:33
SpamBayes Score 1.1373213e-10
Marked as misclassified No
Message-id <1306611575.17.0.225268591838.issue11893@psf.upfronthosting.co.za>
In-reply-to
Content
Attached v1 of patch. Please review.

There are some tests using GMail in test_smtpnet.py. They still pass with the patch. I also did manual tests with GMail with both SMTP + starttls and SMTP_SSL.

The idea of the patch is that SMTP.getreply is already doing:
  if self.file is None:
      self.file = self.sock.makefile('rb')
Therefore, the patch invalidates self.file by setting it to None every time self.sock is (re-)assigned to something.

For consistency, setting self.file to None is also done in LMTP.connect when setting self.sock to a Unix socket although it's not necessarily needed there. Not doing this makes the following scenario fail: create an LMTP instance, call connect, send and read some data (self.file gets initialized), call connect again with an Unix socket, reading more data now uses self.file referring to old socket. But I'm not sure if this scenario is a bug or a misuse of the API, aka you shouldn't call connect twice on the same instance.

Note that I didn't test LMTP. Should I or is it obvious enough that the change is ok?
History
Date User Action Args
2011-05-28 19:39:35catalin.iacobsetrecipients: + catalin.iacob, janssen, pitrou, giampaolo.rodola, sijinjoseph, kasun
2011-05-28 19:39:35catalin.iacobsetmessageid: <1306611575.17.0.225268591838.issue11893@psf.upfronthosting.co.za>
2011-05-28 19:39:34catalin.iacoblinkissue11893 messages
2011-05-28 19:39:34catalin.iacobcreate