]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fixed autoreload for Python 3 1405/head
authorEvgeniy Dobrohvalov <scipetr@gmail.com>
Thu, 2 Apr 2015 13:49:36 +0000 (16:49 +0300)
committerEvgeniy Dobrohvalov <scipetr@gmail.com>
Thu, 2 Apr 2015 13:49:36 +0000 (16:49 +0300)
Changed th system module values check to return a list.
In Python 3 it returns a dict_view which could occassionally produce
a runtime error of "dictionary changed size during iteration".

tornado/autoreload.py

index 8856b8c77c6cf86ebff752d99113228264bfa9c2..a52ddde40d497d92a89c1ea6fe29981b0a129a8e 100644 (file)
@@ -175,7 +175,7 @@ def _reload_on_update(modify_times):
         # processes restarted themselves, they'd all restart and then
         # all call fork_processes again.
         return
-    for module in sys.modules.values():
+    for module in list(sys.modules.values()):
         # Some modules play games with sys.modules (e.g. email/__init__.py
         # in the standard library), and occasionally this can cause strange
         # failures in getattr.  Just ignore anything that's not an ordinary