bpo-30681: Change error handling to return None in case of invalid date by timb07 · Pull Request #2229 · python/cpython (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation3 Commits2 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

timb07

In email.utils.parsedate_to_datetime(), check failure to parse date, or invalid date components (such as hour outside 0..23), and return None rather than raising an exception.

Add tests to confirm this behaviour.

@timb07

@the-knights-who-say-ni

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@timb07

@brettcannon

@timb07 would you mind changing the email example to not be sexual in nature? Otherwise we will have to reject this PR since we attempt to keep the code kid-friendly thanks to actually having kids playing with Python's source 😄

@Mariatta

In addition to @brettcannon's comment, please also make the change against the master branch.
It can be backported to 3.6 once the PR on master has been merged.
I'm closing this PR for now.
Please reopen the PR once the appropriate changes have been made, and we can review it.
Thanks.

@timb07 timb07 mannequin mentioned this pull request

Jun 17, 2022