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
gh-95087: Fix IndexError in parsing invalid date in the email module #95201
Conversation
…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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit?
if not (dd and mm and yy): | |
if not all((dd, mm, yy)): |
There was a problem hiding this comment.
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
?
+1 for @corona10 's suggestion, but either way is probably fine. As an @python/email-team member, I'll approve and let you decide.
Thanks @serhiy-storchaka for the PR |
GH-95227 is a backport of this pull request to the 3.11 branch. |
GH-95228 is a backport of this pull request to the 3.10 branch. |
…odule (pythonGH-95201) Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee> (cherry picked from commit ea5ed0ba51c10cfdde7651a475438551964dfdfc) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…odule (pythonGH-95201) Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee> (cherry picked from commit ea5ed0ba51c10cfdde7651a475438551964dfdfc) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: wouter bolsterlee wouter@bolsterl.ee