Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
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 # ---------- versions: +Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38698> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com