[issue30681] email.utils.parsedate_to_datetime() should return None when date cannot be parsed

Georges report at bugs.python.org
Fri Oct 23 04:39:29 EDT 2020


Georges <georges.toth at govcert.etat.lu> added the comment:

@barry Thank you for your input on the PR.

>From what I understood this PR was nearly ready and only missing a small addition to the documentation which I added. So it took me a bit to go through it all :-).

I actually don't see how *parsedate_to_datetime* would ever return None. It is *_parsedate_tz* which returns None on bogus input, in which case *parsedate_to_datetime* raises a TypeError.
This is also covered in the tests, so those should be fine.

In order to continue I suggest to fix the documentation on *parsedate_to_datetime*, remove the mention of it returning None and replacing it with it possibly returning TypeError in case of an invalid date input.

Does that make sense ?


Regarding the backporting, as a user of this I must admit that it would be much appreciated if this could be backported :-).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue30681>
_______________________________________


More information about the Python-bugs-list mailing list