mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
bpo-45239: Fix parsedate_tz when time has more than 2 dots in it (GH-28452)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
parent
f59ed3c310
commit
b9e687618d
3 changed files with 6 additions and 0 deletions
|
@ -130,6 +130,8 @@ def _parsedate_tz(data):
|
|||
[thh, tmm, tss] = tm
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
return None
|
||||
try:
|
||||
yy = int(yy)
|
||||
dd = int(dd)
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
Fixed :func:`email.utils.parsedate_tz` crashing with
|
||||
:exc:`UnboundLocalError` on certain invalid input instead of returning
|
||||
``None``. Patch by Ben Hoyt.
|
Loading…
Add table
Add a link
Reference in a new issue