Skip to content

Make sure MutableHeaders._list is actually a list#1917

Merged
adriangb merged 6 commits intomasterfrom
adriangb-patch-1
Oct 21, 2022
Merged

Make sure MutableHeaders._list is actually a list#1917
adriangb merged 6 commits intomasterfrom
adriangb-patch-1

Conversation

@adriangb
Copy link
Copy Markdown
Contributor

Fixed #1909

scope: typing.Optional[typing.Mapping[str, typing.Any]] = None,
) -> None:
super().__init__(headers, raw, scope)
self._list = list(self._list)
Copy link
Copy Markdown
Contributor

@alex-oleshkevich alex-oleshkevich Oct 19, 2022

Choose a reason for hiding this comment

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

I think doing this (line 595) in the parent class is good enough.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also a test case covering the issue is wanted.

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.

Feel free to update the branch, I’m on my phone and AFK the rest of the day

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same thing. Let's postpone it till morning.

@adriangb
Copy link
Copy Markdown
Contributor Author

Looks like the test revealed a very real issue: we assume that MutableHeaders updates the headers but if we cast it to a list were making a copy. So I had to assign this new list back to scope. Guess that makes sense. What do you think @alex-oleshkevich? Thanks for pushing for a test btw, it was the right call here.

@adriangb adriangb merged commit 9aa0db4 into master Oct 21, 2022
@adriangb adriangb deleted the adriangb-patch-1 branch October 21, 2022 12:57
@jose-rojas0
Copy link
Copy Markdown

Looks like the test revealed a very real issue: we assume that MutableHeaders updates the headers but if we cast it to a list were making a copy. So I had to assign this new list back to scope. Guess that makes sense. What do you think @alex-oleshkevich? Thanks for pushing for a test btw, it was the right call here.

thank you! this was the problem I was alluding to in #1909 - this definitely fixes it. 💯

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.

3 participants