1
0
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 in c8720e7696.
Backport of 99cfb28e99 from master.
This commit is contained in:
shiningfm
2019-02-27 16:35:30 +01:00
committed by Tim Graham
parent 7331dd8a98
commit 4dac17ac93
3 changed files with 8 additions and 1 deletions

View File

@@ -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