This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients barry, lukasz.langa, miss-islington, ncoghlan, r.david.murray, serhiy.storchaka, sim0n, timb07
Date 2020-10-27.07:37:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603784268.47.0.413059357619.issue30681@roundup.psfhosted.org>
In-reply-to
Content
>>> email.utils.parsedate_to_datetime(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/cpython/Lib/email/utils.py", line 200, in parsedate_to_datetime
    raise ValueError('Invalid date value or format "%s"' % str(data))
ValueError: Invalid date value or format "None"

First, the date value is None, not "None".

Second, why not just return None? parsedate() can be used in code like:

   parsedata(headers.get('Date'))

None is an expected argument if the header "Date" is absent. parsedate_to_datetime() is not compatible with parsedata() in this case.

It was a regression introduced in issue16714. Before that parsedate_to_datetime(None) returned None.
History
Date User Action Args
2020-10-27 07:37:48serhiy.storchakasetrecipients: + serhiy.storchaka, barry, ncoghlan, r.david.murray, lukasz.langa, sim0n, timb07, miss-islington
2020-10-27 07:37:48serhiy.storchakasetmessageid: <1603784268.47.0.413059357619.issue30681@roundup.psfhosted.org>
2020-10-27 07:37:48serhiy.storchakalinkissue30681 messages
2020-10-27 07:37:48serhiy.storchakacreate