changeset 26456:86fc4a2863ff

demandimport: refactor processfromitem This will match the next patch smaller and easier to read.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 04 Oct 2015 10:36:54 -0700
parents f2bf76d3d567
children 7e81305092a0
files mercurial/demandimport.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/demandimport.py	Sat Oct 03 15:30:17 2015 -0700
+++ b/mercurial/demandimport.py	Sun Oct 04 10:36:54 2015 -0700
@@ -149,9 +149,10 @@
             If the symbol doesn't exist in the parent module, it must be a
             module. We set missing modules up as _demandmod instances.
             """
-            if getattr(mod, attr, nothing) is nothing:
-                setattr(mod, attr,
-                        _demandmod(attr, mod.__dict__, locals, **kwargs))
+            symbol = getattr(mod, attr, nothing)
+            if symbol is nothing:
+                symbol = _demandmod(attr, mod.__dict__, locals, **kwargs)
+                setattr(mod, attr, symbol)
 
         if level >= 0:
             # Mercurial's enforced import style does not use