This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients Nikita Hoffmann, barry, maxking, r.david.murray, xtreak
Date 2019-11-06.09:45:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1573033531.83.0.305699202128.issue38698@roundup.psfhosted.org>
In-reply-to
Content
This was also reported in issue38708 with the original code added in issue35805. Commenting out the except clause also doesn't raise any error in test suite so I assume the code path was not tested. Maybe the script could be added as part of the test suite.

$ git diff
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index 1668b4a14e..9b6ca3a268 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -2110,10 +2110,10 @@ def parse_message_id(value):
     message_id = MessageID()
     try:
         token, value = get_msg_id(value)
+        message_id.append(token)
     except errors.HeaderParseError:
         message_id.defects.append(errors.InvalidHeaderDefect(
             "Expected msg-id but found {!r}".format(value)))
-    message_id.append(token)
     return message_id

 #
History
Date User Action Args
2019-11-06 09:45:31xtreaksetrecipients: + xtreak, barry, r.david.murray, maxking, Nikita Hoffmann
2019-11-06 09:45:31xtreaksetmessageid: <1573033531.83.0.305699202128.issue38698@roundup.psfhosted.org>
2019-11-06 09:45:31xtreaklinkissue38698 messages
2019-11-06 09:45:31xtreakcreate