[vreg] fix reloading pb w/ module level error stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 06 Oct 2009 17:12:26 +0200
branchstable
changeset 3565 4db55832e8a9
parent 3564 b03cc2416cd5
child 3566 521337e71fbb
[vreg] fix reloading pb w/ module level error
vregistry.py
--- a/vregistry.py	Tue Oct 06 16:50:11 2009 +0200
+++ b/vregistry.py	Tue Oct 06 17:12:26 2009 +0200
@@ -361,10 +361,13 @@
             # if it was modified, raise RegistryOutOfDate to reload everything
             self.info('File %s changed since last visit', filepath)
             raise RegistryOutOfDate()
+        # set update time before module loading, else we get some reloading
+        # weirdness in case of syntax error or other error while importing the
+        # module
+        self._lastmodifs[filepath] = modified_on
         # load the module
         module = load_module_from_name(modname, use_sys=not force_reload)
         self.load_module(module)
-        self._lastmodifs[filepath] = modified_on
         return True
 
     def load_module(self, module):