mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Closes #15925: fix regression in parsedate() and parsedate_tz() that should return None if unable to parse the argument.
This commit is contained in:
parent
deb92b5b1b
commit
1aca31e8f3
4 changed files with 21 additions and 24 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue