Mercurial > public > mercurial-scm > hg
comparison mercurial/demandimport.py @ 29737:ae9a4d6a8d51
demandimport: omit default value of "level" at construction of _demandmod
This makes construction of _demandmod require explicit level value,
and helps to avoid issues like issue5208 in the future.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 06 Aug 2016 22:24:33 +0900 |
parents | 14f077f7519a |
children | 11b3a59e7435 |
comparison
equal
deleted
inserted
replaced
29736:14f077f7519a | 29737:ae9a4d6a8d51 |
---|---|
62 raise | 62 raise |
63 # retry to import with "hgext_" prefix | 63 # retry to import with "hgext_" prefix |
64 return importfunc(hgextname, globals, *args, **kwargs) | 64 return importfunc(hgextname, globals, *args, **kwargs) |
65 | 65 |
66 class _demandmod(object): | 66 class _demandmod(object): |
67 """module demand-loader and proxy""" | 67 """module demand-loader and proxy |
68 def __init__(self, name, globals, locals, level=level): | 68 |
69 Specify 1 as 'level' argument at construction, to import module | |
70 relatively. | |
71 """ | |
72 def __init__(self, name, globals, locals, level): | |
69 if '.' in name: | 73 if '.' in name: |
70 head, rest = name.split('.', 1) | 74 head, rest = name.split('.', 1) |
71 after = [rest] | 75 after = [rest] |
72 else: | 76 else: |
73 head = name | 77 head = name |