summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-04-02 09:47:18 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-04-02 09:47:18 -0700
commit608e6eb2959c6e56e5c702ca0d15fa0e6c2eef16 (patch)
tree15dd8b48de9fc57453d0da0d4952fdecb0c81e51
parent666990a2a09593d33d8e445398b3b322350ea993 (diff)
Added an explanatory comment. Refs #22017
-rw-r--r--django/utils/autoreload.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index 119bebb148..3e38ef0ff1 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -81,6 +81,9 @@ def gen_filenames():
Yields a generator over filenames referenced in sys.modules and translation
files.
"""
+ # N.B. ``list(...)`` is needed, because this runs in parallel with
+ # application code which might be mutating ``sys.modules``, and this will
+ # fail with RuntimeError: cannot mutate dictionary while iterating
filenames = [filename.__file__ for filename in list(sys.modules.values())
if hasattr(filename, '__file__')]