From d114208442a050141d06a56f5c1505efb09b1d99 Mon Sep 17 00:00:00 2001 From: Kui Shi Date: Tue, 15 Oct 2013 06:16:21 +0800 Subject: [PATCH] wrap dict with list() in for loop In python 3, if the dict is changed in the loop, there will be following error: RuntimeError: dictionary changed size during iteration Tranfrom dict with list() to fix it. Partial implements: blueprint py33-support Change-Id: I4b9f5bc083ebe62739a33674d26728d4a8f1a2d6 --- troveclient/openstack/common/apiclient/exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/troveclient/openstack/common/apiclient/exceptions.py b/troveclient/openstack/common/apiclient/exceptions.py index b03def77..33e75a9e 100644 --- a/troveclient/openstack/common/apiclient/exceptions.py +++ b/troveclient/openstack/common/apiclient/exceptions.py @@ -392,7 +392,7 @@ class HttpVersionNotSupported(HttpServerError): # _code_map = dict((c.http_status, c) # for c in HttpError.__subclasses__()) _code_map = {} -for obj in sys.modules[__name__].__dict__.values(): +for obj in list(sys.modules[__name__].__dict__.values()): if isinstance(obj, type): try: http_status = obj.http_status