# HG changeset patch # User Gregory Szorc # Date 2015-10-04 17:36:54 # Node ID 86fc4a2863ff73b4109d2c2ed9ebdef9a4876961 # Parent f2bf76d3d567816649795cf83dc11696f641ac29 demandimport: refactor processfromitem This will match the next patch smaller and easier to read. diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py --- a/mercurial/demandimport.py +++ b/mercurial/demandimport.py @@ -149,9 +149,10 @@ def _demandimport(name, globals=None, lo 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