Closes #15925: fix regression in parsedate() and parsedate_tz() that should return None if unable to parse the argument.
diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py
index 3528d02..cdfa372 100644
--- a/Lib/email/_parseaddr.py
+++ b/Lib/email/_parseaddr.py
@@ -48,6 +48,8 @@
Accounts for military timezones.
"""
res = _parsedate_tz(data)
+ if not res:
+ return
if res[9] is None:
res[9] = 0
return tuple(res)
@@ -62,6 +64,8 @@
source timezone really was UTC.
"""
+ if not data:
+ return
data = data.split()
# The FWS after the comma after the day-of-week is optional, so search and
# adjust for this.