[Python-checkins] r74330 - in python/branches/py3k: Lib/poplib.py Lib/test/test_poplib.py Misc/NEWS

mark.dickinson python-checkins at python.org
Thu Aug 6 18:06:25 CEST 2009


Author: mark.dickinson
Date: Thu Aug 6 18:06:25 2009
New Revision: 74330
Log:
Issue #6622: Fix 'variable referenced before assignment' bug in POP3.apop.
Thanks Vincent Legoll.
Modified:
 python/branches/py3k/Lib/poplib.py
 python/branches/py3k/Lib/test/test_poplib.py
 python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/poplib.py
==============================================================================
--- python/branches/py3k/Lib/poplib.py	(original)
+++ python/branches/py3k/Lib/poplib.py	Thu Aug 6 18:06:25 2009
@@ -282,7 +282,7 @@
 
 NB: mailbox is locked by server from here to 'quit()'
 """
- secret = bytes(secret, self.encoding)
+ secret = bytes(password, self.encoding)
 m = self.timestamp.match(self.welcome)
 if not m:
 raise error_proto('-ERR APOP not supported by server')
Modified: python/branches/py3k/Lib/test/test_poplib.py
==============================================================================
--- python/branches/py3k/Lib/test/test_poplib.py	(original)
+++ python/branches/py3k/Lib/test/test_poplib.py	Thu Aug 6 18:06:25 2009
@@ -36,7 +36,7 @@
 asynchat.async_chat.__init__(self, conn)
 self.set_terminator(b"\r\n")
 self.in_buffer = []
- self.push('+OK dummy pop3 server ready.')
+ self.push('+OK dummy pop3 server ready. <timestamp>')
 
 def collect_incoming_data(self, data):
 self.in_buffer.append(data)
@@ -104,6 +104,9 @@
 def cmd_rpop(self, arg):
 self.push('+OK done nothing.')
 
+ def cmd_apop(self, arg):
+ self.push('+OK done nothing.')
+
 
 class DummyPOP3Server(asyncore.dispatcher, threading.Thread):
 
@@ -169,7 +172,8 @@
 self.server.stop()
 
 def test_getwelcome(self):
- self.assertEqual(self.client.getwelcome(), b'+OK dummy pop3 server ready.')
+ self.assertEqual(self.client.getwelcome(),
+ b'+OK dummy pop3 server ready. <timestamp>')
 
 def test_exceptions(self):
 self.assertRaises(poplib.error_proto, self.client._shortcmd, 'echo -err')
@@ -209,6 +213,9 @@
 def test_rpop(self):
 self.assertOK(self.client.rpop('foo'))
 
+ def test_apop(self):
+ self.assertOK(self.client.apop('foo', 'dummypassword'))
+
 def test_top(self):
 expected = (b'+OK 116 bytes',
 [b'From: postmaster at python.org', b'Content-Type: text/plain',
@@ -239,7 +246,7 @@
 self.set_socket(ssl_socket)
 self.set_terminator(b"\r\n")
 self.in_buffer = []
- self.push('+OK dummy pop3 server ready.')
+ self.push('+OK dummy pop3 server ready. <timestamp>')
 
 class TestPOP3_SSLClass(TestPOP3Class):
 # repeat previous tests by using poplib.POP3_SSL
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Thu Aug 6 18:06:25 2009
@@ -63,6 +63,9 @@
 Library
 -------
 
+- Issue #6622: Fix "local variable 'secret' referenced before
+ assignment" bug in POP3.apop.
+
 - Issue #2715: Remove remnants of Carbon.File from binhex module.
 
 - Issue #6595: The Decimal constructor now allows arbitrary Unicode


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /