diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-09-22 13:59:51 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-09-22 13:59:51 (GMT) |
commit | 752a2241eab92d223b4f803c1cd20494bf17e799 (patch) | |
tree | ab634a875096566015e962674516341bbecde440 /Lib/email/utils.py | |
parent | fb436c4ebaff171cfff789e702dbc6b5a00281cf (diff) | |
download | cpython-752a2241eab92d223b4f803c1cd20494bf17e799.zip cpython-752a2241eab92d223b4f803c1cd20494bf17e799.tar.gz cpython-752a2241eab92d223b4f803c1cd20494bf17e799.tar.bz2 |
#15925: fix regression: return None for null and non-date strings.
Since the logic for null detection had to move into the _parseaddr
functions, I removed the wrappers from email.utils and just import the
_parseaddr functions directly.
Diffstat (limited to 'Lib/email/utils.py')
-rw-r--r-- | Lib/email/utils.py | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/Lib/email/utils.py b/Lib/email/utils.py index 73bc348..6b6d7f4 100644 --- a/Lib/email/utils.py +++ b/Lib/email/utils.py @@ -37,10 +37,7 @@ from email._parseaddr import quote from email._parseaddr import AddressList as _AddressList from email._parseaddr import mktime_tz -# We need wormarounds for bugs in these methods in older Pythons (see below) -from email._parseaddr import parsedate as _parsedate -from email._parseaddr import parsedate_tz as _parsedate_tz -from email._parseaddr import _parsedate_tz as __parsedate_tz +from email._parseaddr import parsedate, parsedate_tz, _parsedate_tz from quopri import decodestring as _qdecode @@ -222,25 +219,8 @@ def make_msgid(idstring=None, domain=None): return msgid - -# These functions are in the standalone mimelib version only because they've -# subsequently been fixed in the latest Python versions. We use this to worm -# around broken older Pythons. -def parsedate(data): - if not data: - return None - return _parsedate(data) - - -def parsedate_tz(data): - if not data: - return None - return _parsedate_tz(data) - def parsedate_to_datetime(data): - if not data: - return None - *dtuple, tz = __parsedate_tz(data) + *dtuple, tz = _parsedate_tz(data) if tz is None: return datetime.datetime(*dtuple[:6]) return datetime.datetime(*dtuple[:6], |