[PATCH 4 of 8] demandimport: pass fromlist to original import function

Yuya Nishihara yuya at tcha.org
Wed Dec 23 07:09:10 CST 2015


On Tue, 22 Dec 2015 22:24:42 -0800, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bos at serpentine.com>
> # Date 1450849086 28800
> #      Tue Dec 22 21:38:06 2015 -0800
> # Node ID 030387dc5db0113c41a0b3b4ba72a118aa2bc84b
> # Parent  84a069c3cf4bfcc56cd889a7c03ef974d3913b98
> demandimport: pass fromlist to original import function
> 
> Without this, nested imports of the variety "from . import wibble" break.
> But that bug is in turn hidden by the "if" clause immediately before,
> which we will excise in the next commit.
> 
> diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py
> --- a/mercurial/demandimport.py
> +++ b/mercurial/demandimport.py
> @@ -191,7 +191,8 @@ def _demandimport(name, globals=None, lo
>                  return _hgextimport(_origimport, name, globals, locals,
>                                      fromlist, level)
>  
> -            mod = _hgextimport(_origimport, name, globals, locals, level=level)
> +            mod = _hgextimport(_origimport, name, globals, locals, fromlist,
> +                               level)
>  
>              for x in fromlist:
>                  processfromitem(mod, x)

Doesn't it disable lazy loading of modules in fromlist?


More information about the Mercurial-devel mailing list