Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/email/_parseaddr.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def _parsedate_tz(data):
yy, tm = tm, yy
if yy[-1] == ',':
yy = yy[:-1]
if not yy[0].isdigit():
if yy and not yy[0].isdigit():
Copy link
Member

Choose a reason for hiding this comment

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

Why not if not (yy and yy[0].isdigit())?

yy, tz = tz, yy
if tm[-1] == ',':
tm = tm[:-1]
Expand Down
1 change: 1 addition & 0 deletions Lib/test/test_email/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -3053,6 +3053,7 @@ def test_parsedate_returns_None_for_invalid_strings(self):
self.assertIsNone(utils.parsedate_tz(' '))
self.assertIsNone(utils.parsedate('0'))
self.assertIsNone(utils.parsedate_tz('0'))
self.assertIsNone(utils.parsedate_tz('17 June , 2022'))
self.assertIsNone(utils.parsedate('A Complete Waste of Time'))
self.assertIsNone(utils.parsedate_tz('A Complete Waste of Time'))
self.assertIsNone(utils.parsedate_tz('Wed, 3 Apr 2002 12.34.56.78+0800'))
Expand Down