Closes #15925: fix regression in parsedate() and parsedate_tz() that should return None if unable to parse the argument.

This commit is contained in:
Georg Brandl 2012-09-22 09:03:56 +02:00
parent deb92b5b1b
commit 1aca31e8f3
4 changed files with 21 additions and 24 deletions

View file

@ -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.