summaryrefslogtreecommitdiff
path: root/django/utils/autoreload.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-12-17 09:46:26 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-12-17 09:46:26 +0100
commitbbabfdcccee9ccd98fc140233dee748253bcb4a2 (patch)
treea4a2d7a44076e956cedffdba5ec42050a4d70503 /django/utils/autoreload.py
parent85712a53552a6457c9362b4bf037b1ba6a2e45e1 (diff)
Fixed #19485 -- Python 3 compatibility for c2a6b2a4.
Refs #9589.
Diffstat (limited to 'django/utils/autoreload.py')
-rw-r--r--django/utils/autoreload.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index f600f0611c..617fc9da7d 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -56,8 +56,13 @@ _error_files = []
def code_changed():
global _mtimes, _win
- filenames = [getattr(m, "__file__", None) for m in sys.modules.values()]
- for filename in filter(None, filenames) + _error_files:
+ filenames = []
+ for m in sys.modules.values():
+ try:
+ filenames.append(m.__file__)
+ except AttributeError:
+ pass
+ for filename in filenames + _error_files:
if filename.endswith(".pyc") or filename.endswith(".pyo"):
filename = filename[:-1]
if filename.endswith("$py.class"):