mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-38698: Prevent UnboundLocalError to pop up in parse_message_id (GH-17277)
parse_message_id() was improperly using a token defined inside an exception handler, which was raising `UnboundLocalError` on parsing an invalid value. https://bugs.python.org/issue38698
This commit is contained in:
parent
8b787964e0
commit
bb815499af
3 changed files with 13 additions and 1 deletions
|
@ -2113,7 +2113,8 @@ def parse_message_id(value):
|
|||
except errors.HeaderParseError:
|
||||
message_id.defects.append(errors.InvalidHeaderDefect(
|
||||
"Expected msg-id but found {!r}".format(value)))
|
||||
message_id.append(token)
|
||||
else:
|
||||
message_id.append(token)
|
||||
return message_id
|
||||
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue