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

Co-authored-by: wouter bolsterlee wouter@bolsterl.ee

…odule

Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
@@ -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

@corona10 corona10 Jul 24, 2022

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

@serhiy-storchaka serhiy-storchaka Jul 25, 2022

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?

warsaw
warsaw approved these changes Jul 24, 2022
Copy link
Member

@warsaw warsaw left a comment

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

@serhiy-storchaka serhiy-storchaka merged commit ea5ed0b into python:main Jul 25, 2022
14 checks passed
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jul 25, 2022

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

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jul 25, 2022

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

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jul 25, 2022

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

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 25, 2022
…odule (pythonGH-95201)

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

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

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

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington added a commit that referenced this issue 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 issue 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
expert-email type-bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants