aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/urllib/request.py
diff options
context:
space:
mode:
authorRaphaƫl Marinier <raphael.marinier@gmail.com>2024-01-16 00:45:01 +0100
committerGitHub <noreply@github.com>2024-01-15 15:45:01 -0800
commit5094690efd7f663f2e0c1a2a633d3344a0557095 (patch)
treefb0e3437f68110ddc5d36c4480c77a528e86788d /Lib/urllib/request.py
parent4f24b92aa0677ed5310dd2d1572b55f4e30c88ef (diff)
downloadcpython-5094690efd7f663f2e0c1a2a633d3344a0557095.tar.gz
cpython-5094690efd7f663f2e0c1a2a633d3344a0557095.zip
gh-91539: Small performance improvement of urrlib.request.getproxies_environment() (#108771)
Small performance improvement of getproxies_environment() when there are many environment variables. In a benchmark with 5k environment variables not related to proxies, and 5 specifying proxies, we get a 10% walltime improvement.
Diffstat (limited to 'Lib/urllib/request.py')
-rw-r--r--Lib/urllib/request.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 1d03259b918..bca594420f6 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -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]