Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
Description
Feature or enhancement
Proposal:
whilevalueandvalue[0]!=';':try:token,value=get_mailbox(value)mailbox_list.append(token)excepterrors.HeaderParseError:leader=None
Each iteration of the loop is accompanied by assigning the valueNone to theleader variable, so
else:token,value=get_invalid_mailbox(value,',;')ifleaderisnotNone:token[:0]= [leader]mailbox_list.append(token)mailbox_list.defects.append(errors.InvalidHeaderDefect("invalid mailbox in mailbox-list"))
the code will not be executed after checking leader forNone. because the value of the leader variable will not change from the moment of the initial assignment until the else block is called.
Link to the method code:
cpython/Lib/email/_header_value_parser.py
Line 1855 in180b3eb
defget_mailbox_list(value): |
Same situation was found here:
cpython/Lib/email/_header_value_parser.py
Line 2008 in180b3eb
defget_address_list(value): |
Specifically:
whilevalue:try:token,value=get_address(value)address_list.append(token)excepterrors.HeaderParseError:leader=None
The leader variable has been set to NULL...
else:token,value=get_invalid_mailbox(value,',')ifleaderisnotNone:token[:0]= [leader]address_list.append(Address([token]))address_list.defects.append(errors.InvalidHeaderDefect("invalid address in address-list"))
...which has not changed at the time the else block was executed. This behavior occurs at each iteration of the loop.
I will try to form a pull request for correction.
Found byLinux Verification Center with SVACE
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response