comparison mercurial/demandimport.py @ 32365:b2b5605285ec

demandimport: strictly check missing locals argument locals may be an empty dict.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 20 May 2017 15:09:14 +0900
parents c939fdce0fde
children
comparison
equal deleted inserted replaced
32364:7cd1fa9dfd74 32365:b2b5605285ec
156 setattr(self._module, attr, val) 156 setattr(self._module, attr, val)
157 157
158 _pypy = '__pypy__' in sys.builtin_module_names 158 _pypy = '__pypy__' in sys.builtin_module_names
159 159
160 def _demandimport(name, globals=None, locals=None, fromlist=None, level=level): 160 def _demandimport(name, globals=None, locals=None, fromlist=None, level=level):
161 if not locals or name in ignore or fromlist == ('*',): 161 if locals is None or name in ignore or fromlist == ('*',):
162 # these cases we can't really delay 162 # these cases we can't really delay
163 return _hgextimport(_import, name, globals, locals, fromlist, level) 163 return _hgextimport(_import, name, globals, locals, fromlist, level)
164 elif not fromlist: 164 elif not fromlist:
165 # import a [as b] 165 # import a [as b]
166 if '.' in name: # a.b 166 if '.' in name: # a.b