]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 88231 via svnmerge from
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>
Sat, 29 Jan 2011 18:43:43 +0000 (18:43 +0000)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>
Sat, 29 Jan 2011 18:43:43 +0000 (18:43 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88231 | alexander.belopolsky | 2011-01-29 12:19:08 -0500 (Sat, 29 Jan 2011) | 4 lines

  Issue #10939: Fixed imaplib.Internaldate2tuple(). Thanks Joe Peterson
  for the report and the patch.  Reviewed by Georg Brandl.
........

Lib/imaplib.py
Lib/test/test_imaplib.py
Misc/ACKS

index 77806db4e145b3f8a05a8f681f232f35ab0ecd0f..fc1e20a27dcde10b7946df1a88fa8342e75e5b41 100644 (file)
@@ -1266,8 +1266,8 @@ class _Authenticator:
 
 
 
-Mon2num = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,
-        'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
+Mon2num = {b'Jan': 1, b'Feb': 2, b'Mar': 3, b'Apr': 4, b'May': 5, b'Jun': 6,
+           b'Jul': 7, b'Aug': 8, b'Sep': 9, b'Oct': 10, b'Nov': 11, b'Dec': 12}
 
 def Internaldate2tuple(resp):
     """Convert IMAP4 INTERNALDATE to UT.
@@ -1293,7 +1293,7 @@ def Internaldate2tuple(resp):
     # INTERNALDATE timezone must be subtracted to get UT
 
     zone = (zoneh*60 + zonem)*60
-    if zonen == '-':
+    if zonen == b'-':
         zone = -zone
 
     tt = (year, mon, day, hour, min, sec, -1, -1, -1)
index 1ab28c57f8de23c111416a270d35e44ec87a69f6..39984c535de564ea046c3db7ea94b5cb9790a21b 100644 (file)
@@ -26,6 +26,17 @@ CERTFILE = None
 
 class TestImaplib(unittest.TestCase):
 
+    def test_Internaldate2tuple(self):
+        tt = imaplib.Internaldate2tuple(
+            b'25 (INTERNALDATE "01-Jan-1970 00:00:00 +0000")')
+        self.assertEqual(time.mktime(tt), 0)
+        tt = imaplib.Internaldate2tuple(
+            b'25 (INTERNALDATE "01-Jan-1970 11:30:00 +1130")')
+        self.assertEqual(time.mktime(tt), 0)
+        tt = imaplib.Internaldate2tuple(
+            b'25 (INTERNALDATE "31-Dec-1969 12:30:00 -1130")')
+        self.assertEqual(time.mktime(tt), 0)
+
     def test_that_Time2Internaldate_returns_a_result(self):
         # We can check only that it successfully produces a result,
         # not the correctness of the result itself, since the result
index f9a7c4054fc58fd3a0203fe1d617e85f3027b8c9..c38550d8a70da2ab073005de8774cd5e5a8e0910 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -611,6 +611,7 @@ Trevor Perrin
 Gabriel de Perthuis
 Tim Peters
 Benjamin Peterson
+Joe Peterson
 Chris Petrilli
 Bjorn Pettersen
 Geoff Philbrick