Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Aug 11, 2019

Conversation

maxking
Copy link
Contributor

@maxking maxking commented Jul 31, 2019

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
Member

I will review this.

Copy link
Member

@kushaldas kushaldas left a comment

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 🌈

@@ -582,7 +584,7 @@ def value(self):
for x in self:
if x.token_type == 'quoted-string':
quote = True
if quote:
if self and quote:
Copy link
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
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.

Copy link
Member

@CuriousLearner CuriousLearner left a comment

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.

Co-Authored-By: Sanyam Khurana <8039608+CuriousLearner@users.noreply.github.com>
Copy link
Member

@CuriousLearner CuriousLearner left a comment

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 🌮 💯

@miss-islington miss-islington merged commit 09a1872 into python:master Aug 11, 2019
@miss-islington
Copy link
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 bedevere-bot removed the needs backport to 3.8 only security fixes label Aug 11, 2019
@bedevere-bot
Copy link

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

@bedevere-bot
Copy link

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.

None yet

7 participants