From 1aca31e8f329e19de62a2f1a2080995e5712a9cd Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 22 Sep 2012 09:03:56 +0200 Subject: Closes #15925: fix regression in parsedate() and parsedate_tz() that should return None if unable to parse the argument. --- Lib/email/_parseaddr.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Lib/email/_parseaddr.py') diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py index 3528d0297c..cdfa3729ad 100644 --- a/Lib/email/_parseaddr.py +++ b/Lib/email/_parseaddr.py @@ -48,6 +48,8 @@ def parsedate_tz(data): 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 @@ def _parsedate_tz(data): 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. -- cgit v1.2.1