mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[2.2.x] Fixed #30215 -- Fixed autoreloader crash for modules without __spec__.
Regression inc8720e7696. Backport of99cfb28e99from master.
This commit is contained in:
@@ -111,7 +111,7 @@ 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 module.__spec__ is None:
|
||||
if not isinstance(module, ModuleType) or 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