Skip to content

gh-91539: Small performance improvement of urrlib.request.getproxies_environment() #108771

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/urllib/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,7 @@ def getproxies_environment():
# select only environment variables which end in (after making lowercase) _proxy
proxies = {}
environment = []
for name in os.environ.keys():
for name in os.environ:
# fast screen underscore position before more expensive case-folding
if len(name) > 5 and name[-6] == "_" and name[-5:].lower() == "proxy":
value = os.environ[name]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Small (10 - 20%) and trivial performance improvement of :func:`urrlib.request.getproxies_environment`, typically useful when there are many environment variables to go over.