##// END OF EJS Templates
demandimport: avoid infinite recursion at actual module importing (issue5304)...
FUJIWARA Katsunori -
r29642:8960fcb7 stable
parent child Browse files
Show More
@@ -94,6 +94,23 b' class _demandmod(object):'
94 if not self._module:
94 if not self._module:
95 head, globals, locals, after, level, modrefs = self._data
95 head, globals, locals, after, level, modrefs = self._data
96 mod = _hgextimport(_import, head, globals, locals, None, level)
96 mod = _hgextimport(_import, head, globals, locals, None, level)
97 if mod is self:
98 # In this case, _hgextimport() above should imply
99 # _demandimport(). Otherwise, _hgextimport() never
100 # returns _demandmod. This isn't intentional behavior,
101 # in fact. (see also issue5304 for detail)
102 #
103 # If self._module is already bound at this point, self
104 # should be already _load()-ed while _hgextimport().
105 # Otherwise, there is no way to import actual module
106 # as expected, because (re-)invoking _hgextimport()
107 # should cause same result.
108 # This is reason why _load() returns without any more
109 # setup but assumes self to be already bound.
110 mod = self._module
111 assert mod and mod is not self, "%s, %s" % (self, mod)
112 return
113
97 # load submodules
114 # load submodules
98 def subload(mod, p):
115 def subload(mod, p):
99 h, t = p, None
116 h, t = p, None
General Comments 0
You need to be logged in to leave comments. Login now