Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow urllib.requests.install_opener to be reset#15477

Merged
srittau merged 1 commit intopython:mainfrom
ewerybody:master
Mar 2, 2026
Merged

Allow urllib.requests.install_opener to be reset#15477
srittau merged 1 commit intopython:mainfrom
ewerybody:master

Conversation

@ewerybody
Copy link
Contributor

The original _opener in urllib.request is already None (see .../urllib/request.py#L136)

but install_opener currently forbids you to reset it to the original state accepting only OpenerDirector so far. (see .../stdlib/urllib/request.pyi#L95)

Here we make it accept None as well to restore the original behavior.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

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

ewerybody added a commit to ewerybody/a2 that referenced this pull request Mar 2, 2026
ignoring this proxy resetter. Maybe we can soon remove it when this gets approved and published :) python/typeshed#15477
Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks!

@srittau srittau merged commit ceaa3e1 into python:main Mar 2, 2026
51 checks passed
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.

2 participants