Submitter | Yuya Nishihara |
---|---|
Date | May 20, 2017, 8:41 a.m. |
Message ID | <f8ff1fc7f71f1a5956f3.1495269668@mimosa> |
Download | mbox | patch |
Permalink | /patch/20761/ |
State | Accepted |
Headers | show |
Comments
On Sat, May 20, 2017 at 1:41 AM, Yuya Nishihara <yuya@tcha.org> wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1495260554 -32400 > # Sat May 20 15:09:14 2017 +0900 > # Node ID f8ff1fc7f71f1a5956f300050014a1ebb74fdacb > # Parent e54e0e4af63f49e42002258958698bc1fb418efb > demandimport: strictly check missing locals argument > Queued this series with delight! I'm really glad to see the hacky module importer on Python 2 go away. test-check-commit.t is complaining about some double empty lines. But AFAICT those are from the file renames and can be ignored. > > locals may be an empty dict. > > diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py > --- a/mercurial/demandimport.py > +++ b/mercurial/demandimport.py > @@ -158,7 +158,7 @@ class _demandmod(object): > _pypy = '__pypy__' in sys.builtin_module_names > > def _demandimport(name, globals=None, locals=None, fromlist=None, > level=level): > - if not locals or name in ignore or fromlist == ('*',): > + if locals is None or name in ignore or fromlist == ('*',): > # these cases we can't really delay > return _hgextimport(_import, name, globals, locals, fromlist, > level) > elif not fromlist: > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel >
Patch
diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py --- a/mercurial/demandimport.py +++ b/mercurial/demandimport.py @@ -158,7 +158,7 @@ class _demandmod(object): _pypy = '__pypy__' in sys.builtin_module_names def _demandimport(name, globals=None, locals=None, fromlist=None, level=level): - if not locals or name in ignore or fromlist == ('*',): + if locals is None or name in ignore or fromlist == ('*',): # these cases we can't really delay return _hgextimport(_import, name, globals, locals, fromlist, level) elif not fromlist: