You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Docs for urllib.request.urlcleanup does not mention that it will uninstall openers installed with urllib.request.install_opener #102591
"""Clean up temporary files from urlretrieve calls."""
fortemp_filein_url_tempfiles:
try:
os.unlink(temp_file)
exceptOSError:
pass
del_url_tempfiles[:]
global_opener
if_opener:
_opener=None
However, this uninstallation of a previously installed global opener is not documented.
If the uninstallation of openers installed with install_opener is intended, then it would be best to document it in urlcleanup, and if it is not intended this should be a bug instead of a doc issue.
Hi, I’d like to work on this documentation issue. I plan to update the urlcleanup() documentation to mention that it also resets the default global opener installed by install_opener(). I expect to submit a small documentation-only PR within the next few days.
Activity
aucampia commentedon Mar 10, 2023
See also:
urllib.request.install_opener(None)will uninstall the global opener @ discuss.python.orgarhadthedev commentedon Apr 2, 2023
@orsenthil (as an urllib expert)
orsenthil commentedon Apr 3, 2023
Please go ahead and submit a patch. Thank you.
Taeknology commentedon Jul 11, 2026
Hi, I’d like to work on this documentation issue. I plan to update the
urlcleanup()documentation to mention that it also resets the default global opener installed byinstall_opener(). I expect to submit a small documentation-only PR within the next few days.Merge branch 'main' into pythongh-102591-document-urlcleanup
gh-102591: Document that urlcleanup resets the global opener (#153562)
[3.15] gh-102591: Document that urlcleanup resets the global opener (G…
[3.14] gh-102591: Document that urlcleanup resets the global opener (G…
[3.13] gh-102591: Document that urlcleanup resets the global opener (G…
orsenthil commentedon Jul 11, 2026
Thanks for the patch, @Taeknology .