Skip to content

bpo-32178: Fix IndexError trying to parse 'To' header starting with ':'.#15044

Merged
miss-islington merged 4 commits into
python:masterfrom
maxking:32178
Aug 11, 2019
Merged

bpo-32178: Fix IndexError trying to parse 'To' header starting with ':'.#15044
miss-islington merged 4 commits into
python:masterfrom
maxking:32178

Conversation

@maxking

@maxking maxking commented Jul 31, 2019

Copy link
Copy Markdown
Contributor

This should fix the IndexError trying to retrieve DisplayName.display_name and DisplayName.value when the value is basically an empty string.

https://bugs.python.org/issue32178

Automerge-Triggered-By: @maxking

@kushaldas

Copy link
Copy Markdown
Member

I will review this.

@kushaldas kushaldas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as suggested. Tested on Debian Stretch. Thank you @maxking 🌈

Comment thread Lib/email/_header_value_parser.py Outdated
if x.token_type == 'quoted-string':
quote = True
if quote:
if self and quote:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in which case, self would be None|False|0?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be len(self) != 0 for being more explicit, like in the method above, I'll make the changes.

This would be when the TokenList is empty with no tokens.

Comment thread Lib/test/test_email/test__header_value_parser.py Outdated

@CuriousLearner CuriousLearner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Just one more minor suggestion. Please find my suggestion inline.

Comment thread Misc/NEWS.d/next/Library/2019-07-30-22-41-05.bpo-32178.X-IFLe.rst Outdated
Co-Authored-By: Sanyam Khurana <8039608+CuriousLearner@users.noreply.github.com>

@CuriousLearner CuriousLearner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may re-run the Travis tests and they should pass. Just one more nit-pick.

Overall LGTM 🌮 💯

Comment thread Lib/test/test_email/test__header_value_parser.py
@miss-islington miss-islington merged commit 09a1872 into python:master Aug 11, 2019
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @maxking for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 11, 2019
…:'. (pythonGH-15044)

This should fix the IndexError trying to retrieve `DisplayName.display_name` and `DisplayName.value` when the `value` is basically an empty string.

https://bugs.python.org/issue32178
(cherry picked from commit 09a1872)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
@bedevere-bot

Copy link
Copy Markdown

GH-15213 is a backport of this pull request to the 3.8 branch.

@bedevere-bot

Copy link
Copy Markdown

GH-15214 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 11, 2019
…:'. (pythonGH-15044)

This should fix the IndexError trying to retrieve `DisplayName.display_name` and `DisplayName.value` when the `value` is basically an empty string.

https://bugs.python.org/issue32178
(cherry picked from commit 09a1872)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
@maxking maxking deleted the 32178 branch August 11, 2019 20:49
miss-islington added a commit that referenced this pull request Aug 11, 2019
…:'. (GH-15044)

This should fix the IndexError trying to retrieve `DisplayName.display_name` and `DisplayName.value` when the `value` is basically an empty string.

https://bugs.python.org/issue32178
(cherry picked from commit 09a1872)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
miss-islington added a commit that referenced this pull request Aug 11, 2019
…:'. (GH-15044)

This should fix the IndexError trying to retrieve `DisplayName.display_name` and `DisplayName.value` when the `value` is basically an empty string.

https://bugs.python.org/issue32178
(cherry picked from commit 09a1872)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
…:'. (pythonGH-15044)

This should fix the IndexError trying to retrieve `DisplayName.display_name` and `DisplayName.value` when the `value` is basically an empty string.




https://bugs.python.org/issue32178
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
…:'. (pythonGH-15044)

This should fix the IndexError trying to retrieve `DisplayName.display_name` and `DisplayName.value` when the `value` is basically an empty string.




https://bugs.python.org/issue32178
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
…:'. (pythonGH-15044)

This should fix the IndexError trying to retrieve `DisplayName.display_name` and `DisplayName.value` when the `value` is basically an empty string.




https://bugs.python.org/issue32178
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants