[Python-checkins] cpython (merge default -> default): merge heads

gregory.p.smith python-checkins at python.org
Thu Mar 21 05:01:12 CET 2013


http://hg.python.org/cpython/rev/792ffbf6295e
changeset:   82864:792ffbf6295e
parent:      82863:231a7fa6c5be
parent:      82861:3969797dd598
user:        Gregory P. Smith <greg at krypto.org>
date:        Wed Mar 20 20:53:21 2013 -0700
summary:
  merge heads

files:
  Lib/test/test_smtplib.py |  9 ++++++---
  Lib/threading.py         |  3 +--
  2 files changed, 7 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -662,12 +662,12 @@
         if self.rcpt_response is None:
             super().smtp_RCPT(arg)
             return
-        self.push(self.rcpt_response[self.rcpt_count])
         self.rcpt_count += 1
+        self.push(self.rcpt_response[self.rcpt_count-1])
 
     def smtp_RSET(self, arg):
+        self.rset_count += 1
         super().smtp_RSET(arg)
-        self.rset_count += 1
 
     def smtp_DATA(self, arg):
         if self.data_response is None:
@@ -842,14 +842,16 @@
     # Issue 5713: make sure close, not rset, is called if we get a 421 error
     def test_421_from_mail_cmd(self):
         smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
+        smtp.noop()
         self.serv._SMTPchannel.mail_response = '421 closing connection'
         with self.assertRaises(smtplib.SMTPSenderRefused):
             smtp.sendmail('John', 'Sally', 'test message')
         self.assertIsNone(smtp.sock)
-        self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0)
+        self.assertEqual(self.serv._SMTPchannel.rset_count, 0)
 
     def test_421_from_rcpt_cmd(self):
         smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
+        smtp.noop()
         self.serv._SMTPchannel.rcpt_response = ['250 accepted', '421 closing']
         with self.assertRaises(smtplib.SMTPRecipientsRefused) as r:
             smtp.sendmail('John', ['Sally', 'Frank', 'George'], 'test message')
@@ -866,6 +868,7 @@
                     super().found_terminator()
         self.serv.channel_class = MySimSMTPChannel
         smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15)
+        smtp.noop()
         with self.assertRaises(smtplib.SMTPDataError):
             smtp.sendmail('John at foo.org', ['Sally at foo.org'], 'test message')
         self.assertIsNone(smtp.sock)
diff --git a/Lib/threading.py b/Lib/threading.py
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -10,11 +10,10 @@
     from time import time as _time
 from traceback import format_exc as _format_exc
 from _weakrefset import WeakSet
+from itertools import islice as _islice
 try:
-    from _itertools import islice as _slice
     from _collections import deque as _deque
 except ImportError:
-    from itertools import islice as _islice
     from collections import deque as _deque
 
 # Note regarding PEP 8 compliant names

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list