author | Siddharth Agarwal <sid0@fb.com> |
Sun, 21 May 2017 13:26:17 -0700 | |
changeset 32425 | 397e3a2e9347 |
parent 32424 | b4810bf95c03 |
child 32426 | 06aa645e2372 |
--- a/mercurial/__init__.py Sun May 21 12:51:01 2017 -0700 +++ b/mercurial/__init__.py Sun May 21 13:26:17 2017 -0700 @@ -53,7 +53,14 @@ # TODO need to support loaders from alternate specs, like zip # loaders. - spec.loader = hgloader(spec.name, spec.origin) + loader = hgloader(spec.name, spec.origin) + # Can't use util.safehasattr here because that would require + # importing util, and we're in import code. + if hasattr(spec.loader, 'loader'): # hasattr-py3-only + # This is a nested loader (maybe a lazy loader?) + spec.loader.loader = loader + else: + spec.loader = loader return spec def replacetokens(tokens, fullname):