X Tutup
The Wayback Machine - https://web.archive.org/web/20230310210916/https://github.com/python/cpython/issues/102591
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

Docs for urllib.request.urlcleanup does not mention that it will uninstall openers installed with urllib.request.install_opener #102591

Open
aucampia opened this issue Mar 10, 2023 · 0 comments
Labels
docs Documentation in the Doc dir

Comments

@aucampia
Copy link
Sponsor

Documentation

urllib.request.install_opener sets urllib.request._opener to the supplied value:

def install_opener(opener):
global _opener
_opener = opener

And urllib.request.urlcleanup sets urllib.requests._opener to None:

def urlcleanup():
"""Clean up temporary files from urlretrieve calls."""
for temp_file in _url_tempfiles:
try:
os.unlink(temp_file)
except OSError:
pass
del _url_tempfiles[:]
global _opener
if _opener:
_opener = None

However, this removal of the installed opener is not documented.

If the uninstallation of openers installed with install_opener intended, then it would be best to document it urlcleanup, and if it is not intended this should be a bug instead of a doc issue.

@aucampia aucampia added the docs Documentation in the Doc dir label Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

1 participant
X Tutup