aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/email/_parseaddr.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/email/_parseaddr.py')
-rw-r--r--Lib/email/_parseaddr.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py
index ba5ad5a36d0..febe411355d 100644
--- a/Lib/email/_parseaddr.py
+++ b/Lib/email/_parseaddr.py
@@ -95,6 +95,8 @@ def _parsedate_tz(data):
return None
data = data[:5]
[dd, mm, yy, tm, tz] = data
+ if not (dd and mm and yy):
+ return None
mm = mm.lower()
if mm not in _monthnames:
dd, mm = mm, dd.lower()
@@ -110,6 +112,8 @@ def _parsedate_tz(data):
yy, tm = tm, yy
if yy[-1] == ',':
yy = yy[:-1]
+ if not yy:
+ return None
if not yy[0].isdigit():
yy, tz = tz, yy
if tm[-1] == ',':