summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-08-06 16:08:07 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-08-06 16:08:07 (GMT)
commit825b993542563d76b08ca7b01729b20837ba9245 (patch)
tree4cfc87f0da19dca1d6e4f2f850df913e3d1bcfc0 /Lib
parent82d64579056d9010772a5ac72fbf2011ac5b7b76 (diff)
downloadcpython-825b993542563d76b08ca7b01729b20837ba9245.zip
cpython-825b993542563d76b08ca7b01729b20837ba9245.tar.gz
cpython-825b993542563d76b08ca7b01729b20837ba9245.tar.bz2
Merged revisions 74330 via svnmerge from
svn+ssh://pythondev@www.python.org/python/branches/py3k ........ r74330 | mark.dickinson | 2009-08-06 17:06:25 +0100 (Thu, 06 Aug 2009) | 3 lines Issue #6622: Fix 'variable referenced before assignment' bug in POP3.apop. Thanks Vincent Legoll. ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/poplib.py2
-rw-r--r--Lib/test/test_poplib.py13
2 files changed, 11 insertions, 4 deletions
diff --git a/Lib/poplib.py b/Lib/poplib.py
index 770819e..1a529d0 100644
--- a/Lib/poplib.py
+++ b/Lib/poplib.py
@@ -282,7 +282,7 @@ class POP3:
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')
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py
index ad00802..1807bca 100644
--- a/Lib/test/test_poplib.py
+++ b/Lib/test/test_poplib.py
@@ -36,7 +36,7 @@ class DummyPOP3Handler(asynchat.async_chat):
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 @@ class DummyPOP3Handler(asynchat.async_chat):
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 @@ class TestPOP3Class(TestCase):
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 @@ class TestPOP3Class(TestCase):
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@python.org', b'Content-Type: text/plain',
@@ -239,7 +246,7 @@ if hasattr(poplib, 'POP3_SSL'):
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