Serhiy Storchaka <[email protected]> added the comment:
>>> 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.
----------
nosy: +serhiy.storchaka
status: closed -> open
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue30681>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com