mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[2.2.x] Fixed #30479 -- Fixed detecting changes in manage.py by autoreloader when using StatReloader.
Regression inc8720e7696. Backport ofb2790f74d4from master
This commit is contained in:
committed by
Mariusz Felisiak
parent
853586ee2c
commit
5bf2c87ece
@@ -111,7 +111,15 @@ def iter_modules_and_files(modules, extra_files):
|
||||
# During debugging (with PyDev) the 'typing.io' and 'typing.re' objects
|
||||
# are added to sys.modules, however they are types not modules and so
|
||||
# cause issues here.
|
||||
if not isinstance(module, ModuleType) or getattr(module, '__spec__', None) is None:
|
||||
if not isinstance(module, ModuleType):
|
||||
continue
|
||||
if module.__name__ == '__main__':
|
||||
# __main__ (usually manage.py) doesn't always have a __spec__ set.
|
||||
# Handle this by falling back to using __file__, resolved below.
|
||||
# See https://docs.python.org/reference/import.html#main-spec
|
||||
sys_file_paths.append(module.__file__)
|
||||
continue
|
||||
if getattr(module, '__spec__', None) is None:
|
||||
continue
|
||||
spec = module.__spec__
|
||||
# Modules could be loaded from places without a concrete location. If
|
||||
|
||||
Reference in New Issue
Block a user