From 4083c20e173665c170a1a258b33cbc921ee45a75 2014-11-19 14:53:21
From: ajholyoake <a.j.holyoake@gmail.com>
Date: 2014-11-19 14:53:21
Subject: [PATCH] Catch if module file is not set

When loading .net assemblies after import clr, the file attribute is present but not set, causing the autoreload module to not work appropriately.
---

diff --git a/IPython/extensions/autoreload.py b/IPython/extensions/autoreload.py
index 0b65758..8459dc7 100644
--- a/IPython/extensions/autoreload.py
+++ b/IPython/extensions/autoreload.py
@@ -183,7 +183,7 @@ class ModuleReloader(object):
         return top_module, top_name
 
     def filename_and_mtime(self, module):
-        if not hasattr(module, '__file__'):
+        if not hasattr(module, '__file__') or module.__file__ is None:
             return None, None
 
         if module.__name__ == '__main__':