]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Resolution of bug #997368, "strftime() backward compatibility".
authorBarry Warsaw <barry@python.org>
Sat, 7 Aug 2004 16:38:40 +0000 (16:38 +0000)
committerBarry Warsaw <barry@python.org>
Sat, 7 Aug 2004 16:38:40 +0000 (16:38 +0000)
Specifically, time.strftime() no longer accepts a 0 in the yday position of a
time tuple, since that can crash some platform strftime() implementations.

parsedate_tz(): Change the return value to return 1 in the yday position.

Update tests in test_rfc822.py and test_email.py

Lib/email/_parseaddr.py
Lib/email/test/test_email.py
Lib/rfc822.py
Lib/test/test_rfc822.py

index 167eb3fcf9cc01826d11680be9620f9da6d0d84e..4a31affe9f95a097afe90d111a66c07d04e806b7 100644 (file)
@@ -116,7 +116,7 @@ def parsedate_tz(data):
         else:
             tzsign = 1
         tzoffset = tzsign * ( (tzoffset/100)*3600 + (tzoffset % 100)*60)
-    tuple = (yy, mm, dd, thh, tmm, tss, 0, 0, 0, tzoffset)
+    tuple = (yy, mm, dd, thh, tmm, tss, 0, 1, 0, tzoffset)
     return tuple
 
 
index 1749102334c470c9fe5994777960fe5dfd7c6d73..4479fb2976fc9ad163ea0937ed071a7e0c020eab 100644 (file)
@@ -2098,12 +2098,12 @@ class TestMiscellaneous(unittest.TestCase):
     def test_parsedate_no_dayofweek(self):
         eq = self.assertEqual
         eq(Utils.parsedate_tz('25 Feb 2003 13:47:26 -0800'),
-           (2003, 2, 25, 13, 47, 26, 0, 0, 0, -28800))
+           (2003, 2, 25, 13, 47, 26, 0, 1, 0, -28800))
 
     def test_parsedate_compact_no_dayofweek(self):
         eq = self.assertEqual
         eq(Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800'),
-           (2003, 2, 5, 13, 47, 26, 0, 0, 0, -28800))
+           (2003, 2, 5, 13, 47, 26, 0, 1, 0, -28800))
 
     def test_parseaddr_empty(self):
         self.assertEqual(Utils.parseaddr('<>'), ('', ''))
index 3811a59b208e824cc54aede33c412c1fb4d3fac8..3b4246de924eed661c6b119c54d1330a080a2d5d 100644 (file)
@@ -927,7 +927,7 @@ def parsedate_tz(data):
         else:
             tzsign = 1
         tzoffset = tzsign * ( (tzoffset//100)*3600 + (tzoffset % 100)*60)
-    tuple = (yy, mm, dd, thh, tmm, tss, 0, 0, 0, tzoffset)
+    tuple = (yy, mm, dd, thh, tmm, tss, 0, 1, 0, tzoffset)
     return tuple
 
 
index c450bf97ce09e4a37747a8920cafee5bd59d14bb..491bc8aba0b511b95f5b11061274e2b94bfe593a 100644 (file)
@@ -53,7 +53,7 @@ class MessageTestCase(unittest.TestCase):
         out = m.getdate('date')
         if out:
             self.assertEqual(out,
-                             (1999, 1, 13, 23, 57, 35, 0, 0, 0),
+                             (1999, 1, 13, 23, 57, 35, 0, 1, 0),
                              "date conversion failed")