[issue38698] While parsing email message id: UnboundLocalError

R. David Murray report at bugs.python.org
Sun Nov 24 13:00:52 EST 2019


R. David Murray <rdmurray at bitdance.com> added the comment:

More tests are always good :)

The "correct" solution here (as far as I remember, its has been a while since I've had time to even looked at the _header_value_parser code) would be to add a new 'invalid-msg-id' token, and do this:

    message_id = MessageID()
    try:
        token, value = get_msg_id(value)
        message_id.append(token)
    except HeaderParseError as ex:
        message_id = InvalidMessageID(value)
        message_id.defects.append(InvalidHeaderDefect(
            f"Invalid msg_id: {ex}"))
    return message_id

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38698>
_______________________________________


More information about the Python-bugs-list mailing list