diff options
author | Ben Hoyt <benhoyt@gmail.com> | 2021-10-13 16:21:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 16:21:27 (GMT) |
commit | b9e687618d3489944f29adbd2be50b46940c9e70 (patch) | |
tree | 4b842bd26f144865265546fae88c373a62202725 /Lib | |
parent | f59ed3c310a7ceebf2a56a84ea969a7f75d95b64 (diff) | |
download | cpython-b9e687618d3489944f29adbd2be50b46940c9e70.zip cpython-b9e687618d3489944f29adbd2be50b46940c9e70.tar.gz cpython-b9e687618d3489944f29adbd2be50b46940c9e70.tar.bz2 |
bpo-45239: Fix parsedate_tz when time has more than 2 dots in it (GH-28452)
Co-authored-by: Ćukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/email/_parseaddr.py | 2 | ||||
-rw-r--r-- | Lib/test/test_email/test_email.py | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py index 977fedf..ba5ad5a 100644 --- a/Lib/email/_parseaddr.py +++ b/Lib/email/_parseaddr.py @@ -128,6 +128,8 @@ def _parsedate_tz(data): tss = 0 elif len(tm) == 3: [thh, tmm, tss] = tm + else: + return None else: return None try: diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py index 4001f71..54ffcdc 100644 --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -3009,6 +3009,7 @@ class TestMiscellaneous(TestEmailBase): self.assertIsNone(utils.parsedate_tz('0')) self.assertIsNone(utils.parsedate('A Complete Waste of Time')) self.assertIsNone(utils.parsedate_tz('A Complete Waste of Time')) + self.assertIsNone(utils.parsedate_tz('Wed, 3 Apr 2002 12.34.56.78+0800')) # Not a part of the spec but, but this has historically worked: self.assertIsNone(utils.parsedate(None)) self.assertIsNone(utils.parsedate_tz(None)) |