10000 Fix requests.Session().hooks by Akuli · Pull Request #7871 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Fix requests.Session().hooks < 8000 span class="f1-light color-fg-muted">#7871

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

Merged
merged 3 commits into from
May 19, 2022
Merged

Fix requests.Session().hooks #7871

merged 3 commits into from
May 19, 2022

Conversation

Akuli
Copy link
Collaborator
@Akuli Akuli commented May 18, 2022

Fixes #7776

Mutating hooks, as in session.hooks['response'] = ..., should work. Reassigning it like session.hooks = ... is probably a bad idea, so it will always be a dict.

Fixes #7776

Mutating hooks, as in `session.hooks['response'] = ...`, should work. Reassigning it like `session.hooks = ...` is probably a bad idea, so it will always be a `dict`.
@Akuli Akuli marked this pull request as draft May 18, 2022 21:40
@Akuli
Copy link
Collaborator Author
Akuli commented May 18, 2022

We still need to discuss whether it's better to use a union or just require hooks to be lists. The usual reason for avoiding union return types applies here: if we merge this PR as is, #7776 still wouldn't work, because it would end up calling .append() on a _Hook | list[_Hook]. #7776 (comment)

@Akuli Akuli changed the title Use dict for requests.Session().hooks Fix requests.Session().hooks May 18, 2022
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@Akuli Akuli marked this pull request as ready for review May 18, 2022 21:59
Copy link
Member
@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Makes sense

@JelleZijlstra JelleZijlstra merged commit 9a09db4 into master May 19, 2022
@JelleZijlstra JelleZijlstra deleted the Akuli-patch-1 branch May 19, 2022 02:31
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.

Regression in requests hooks stubs
3 participants
0