Kaydet (Commit) 608e6eb2 authored tarafından Alex Gaynor's avatar Alex Gaynor

Added an explanatory comment. Refs #22017

üst 666990a2
...@@ -81,6 +81,9 @@ def gen_filenames(): ...@@ -81,6 +81,9 @@ def gen_filenames():
Yields a generator over filenames referenced in sys.modules and translation Yields a generator over filenames referenced in sys.modules and translation
files. 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()) filenames = [filename.__file__ for filename in list(sys.modules.values())
if hasattr(filename, '__file__')] if hasattr(filename, '__file__')]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment