Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-95087: Fix IndexError in parsing invalid date in the email module #95201

Merged
merged 1 commit into from
Jul 25, 2022

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jul 24, 2022

…odule

Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error needs backport to 3.10 only security fixes topic-email needs backport to 3.11 only security fixes labels Jul 24, 2022
@serhiy-storchaka serhiy-storchaka requested a review from a team as a code owner July 24, 2022 10:03
@@ -95,6 +95,8 @@ def _parsedate_tz(data):
return None
data = data[:5]
[dd, mm, yy, tm, tz] = data
if not (dd and mm and yy):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit?

Suggested change
if not (dd and mm and yy):
if not all((dd, mm, yy)):

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks less clear to me (and it is also slower). Do you write sum((dd, mm, yy)) instead of dd + mm + yy?

Copy link
Member

@warsaw warsaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for @corona10 's suggestion, but either way is probably fine. As an @python/email-team member, I'll approve and let you decide.

@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the email-parsedate branch July 25, 2022 06:17
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jul 25, 2022
@bedevere-bot
Copy link

GH-95227 is a backport of this pull request to the 3.11 branch.

@bedevere-bot
Copy link

GH-95228 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jul 25, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 25, 2022
…odule (pythonGH-95201)

Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
(cherry picked from commit ea5ed0b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 25, 2022
…odule (pythonGH-95201)

Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
(cherry picked from commit ea5ed0b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington added a commit that referenced this pull request Jul 25, 2022
…H-95201)

Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
(cherry picked from commit ea5ed0b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington added a commit that referenced this pull request Jul 25, 2022
…H-95201)

Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
(cherry picked from commit ea5ed0b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-email type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants