summaryrefslogtreecommitdiffstats
path: root/Lib/urllib/request.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-06-07 22:08:04 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-06-07 22:08:04 (GMT)
commit3c2dca67ac9cdc26fb02473e05723486ffc8d52b (patch)
treeced412c7a55dc74fd737020c8d101507e52a9da4 /Lib/urllib/request.py
parent4bb09c843240afd0c3f3d502f411c01e585ad08d (diff)
downloadcpython-3c2dca67ac9cdc26fb02473e05723486ffc8d52b.zip
cpython-3c2dca67ac9cdc26fb02473e05723486ffc8d52b.tar.gz
cpython-3c2dca67ac9cdc26fb02473e05723486ffc8d52b.tar.bz2
in ftp cache pruning, avoid changing the size of a dict while iterating over it (closes #21463)
Patch by Skyler Leigh Amador.
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 43d6caa..72e91dd 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1911,7 +1911,7 @@ class URLopener:
# XXX thread unsafe!
if len(self.ftpcache) > MAXFTPCACHE:
# Prune the cache, rather arbitrarily
- for k in self.ftpcache.keys():
+ for k in list(self.ftpcache):
if k != key:
v = self.ftpcache[k]
del self.ftpcache[k]