Ticket #25624: 25624.diff

File 25624.diff, 1.2 KB (added by Paul, 9 years ago)
  • django/utils/autoreload.py

    diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
    index 4fba0fe..1e64243 100644
    a b def gen_filenames(only_new=False):  
    8888    # application code which might be mutating ``sys.modules``, and this will
    8989    # fail with RuntimeError: cannot mutate dictionary while iterating
    9090    global _cached_modules, _cached_filenames
    91     module_values = set(sys.modules.values())
     91    module_values = set([module for module in sys.modules.values()
     92                         if hasattr(module, '__file__')])
    9293    _cached_filenames = clean_files(_cached_filenames)
    9394    if _cached_modules == module_values:
    9495        # No changes in module list, short-circuit the function
    def gen_filenames(only_new=False):  
    9899            return _cached_filenames + clean_files(_error_files)
    99100
    100101    new_modules = module_values - _cached_modules
    101     new_filenames = clean_files(
    102         [filename.__file__ for filename in new_modules
    103          if hasattr(filename, '__file__')])
     102    new_filenames = clean_files([module.__file__ for module in new_modules])
    104103
    105104    if not _cached_filenames and settings.USE_I18N:
    106105        # Add the names of the .mo files that can be generated
Back to Top