aboutsummaryrefslogtreecommitdiff
path: root/urllib3/_collections.py
diff options
context:
space:
mode:
Diffstat (limited to 'urllib3/_collections.py')
-rw-r--r--urllib3/_collections.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/urllib3/_collections.py b/urllib3/_collections.py
index d77ebb8..784342a 100644
--- a/urllib3/_collections.py
+++ b/urllib3/_collections.py
@@ -14,7 +14,7 @@ try: # Python 2.7+
from collections import OrderedDict
except ImportError:
from .packages.ordered_dict import OrderedDict
-from .packages.six import itervalues
+from .packages.six import iterkeys, itervalues
__all__ = ['RecentlyUsedContainer', 'HTTPHeaderDict']
@@ -85,8 +85,7 @@ class RecentlyUsedContainer(MutableMapping):
def clear(self):
with self.lock:
# Copy pointers to all values, then wipe the mapping
- # under Python 2, this copies the list of values twice :-|
- values = list(self._container.values())
+ values = list(itervalues(self._container))
self._container.clear()
if self.dispose_func:
@@ -95,7 +94,7 @@ class RecentlyUsedContainer(MutableMapping):
def keys(self):
with self.lock:
- return self._container.keys()
+ return list(iterkeys(self._container))
class HTTPHeaderDict(MutableMapping):