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
This commit is contained in:
Kui Shi
2013-10-15 06:16:21 +08:00
parent 502f7113a8
commit d114208442

View File

@@ -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