summaryrefslogtreecommitdiff
path: root/keystoneclient/session.py
diff options
context:
space:
mode:
authorCorey Bryant <corey.bryant@canonical.com>2015-10-06 15:11:41 -0400
committerDiana Clarke <diana.joan.clarke@gmail.com>2015-11-10 12:58:12 -0500
commit9399ad917067f812a7079414ff497506202810c8 (patch)
treef953ae9b972c74aa9a207775c63c597938299a6b /keystoneclient/session.py
parent70dbc31484980abfa6f05e349a415a87d269c55e (diff)
downloadpython-keystoneclient-9399ad917067f812a7079414ff497506202810c8.tar.gz
Iterate over copy of session.adapters keys in Python2/3
Iterate over a copy of session.adapters keys in both Python 2.x and Python 3.x. In Python 3.x, keys() is not a copy, and therefore items can't be popped from it while iterating. Note that this patch addresses the following error message which is new in Python 3.5. That is, you need to be using Python 3.5+ to reproduce this error. RuntimeError: OrderedDict mutated during iteration https://bugs.python.org/issue24369 https://hg.python.org/cpython/rev/0d8679858272 Change-Id: Iaa2be0dc8ef26e51ce5e8f50049c9e8f84418ec0 Closes-Bug: #1483872
Diffstat (limited to 'keystoneclient/session.py')
-rw-r--r--keystoneclient/session.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/keystoneclient/session.py b/keystoneclient/session.py
index e3db3b9..ae640b6 100644
--- a/keystoneclient/session.py
+++ b/keystoneclient/session.py
@@ -135,7 +135,7 @@ class Session(object):
if not session:
session = requests.Session()
# Use TCPKeepAliveAdapter to fix bug 1323862
- for scheme in session.adapters:
+ for scheme in list(session.adapters):
session.mount(scheme, TCPKeepAliveAdapter())
self.auth = auth