summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorshiningfm <shiningfm@users.noreply.github.com>2019-02-27 16:35:30 +0100
committerTim Graham <timograham@gmail.com>2019-02-27 10:35:45 -0500
commit4dac17ac93d0fa48ffb806a6cb142c54cc09e8f1 (patch)
treebefa1dc06dbd48ef24756a1ab63a241fe3f1599b /django
parent7331dd8a989465c3deed0db4e37ebbdf9d60bb71 (diff)
[2.2.x] Fixed #30215 -- Fixed autoreloader crash for modules without __spec__.
Regression in c8720e7696ca41f3262d5369365cc1bd72a216ca. Backport of 99cfb28e995388db109e2f2ed15307f09945dda8 from master.
Diffstat (limited to 'django')
-rw-r--r--django/utils/autoreload.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index 383998cfce..33f2b2be96 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