From 99cfb28e995388db109e2f2ed15307f09945dda8 Mon Sep 17 00:00:00 2001 From: shiningfm Date: Wed, 27 Feb 2019 16:35:30 +0100 Subject: Fixed #30215 -- Fixed autoreloader crash for modules without __spec__. Regression in c8720e7696ca41f3262d5369365cc1bd72a216ca. --- django/utils/autoreload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/utils') diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index 931f4b82e4..427d979a7f 100644 --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -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 -- cgit v1.3