importer: new format to signal ImportError

Previously we'd send just None in GET_MODULE reply, but now since there
is no single request-reply structure, we must include the fullname in
the LOAD_MODULE response and make all of its data fields None to
indicate the same.
wip-fakessh-exit-status
David Wilson 7 years ago
parent dee856f6f4
commit 0f899f34ff

@ -520,7 +520,7 @@ class Importer(object):
event.wait()
ret = self._cache[fullname]
if ret is None:
if ret[2] is None:
raise ImportError('Master does not have %r' % (fullname,))
pkg_present = ret[1]

@ -635,6 +635,12 @@ class ModuleResponder(object):
return self._cache[fullname]
path, source, is_pkg = self._finder.get_module_source(fullname)
if source is None:
LOG.error('_build_tuple(%r): could not locate source', fullname)
tup = fullname, None, None, None, None
self._cache[fullname] = tup
return tup
if source is None:
raise ImportError('could not find %r' % (fullname,))
@ -675,8 +681,7 @@ class ModuleResponder(object):
try:
tup = self._build_tuple(fullname)
for name in tup[4]: # related
for name in tup[4] or (): # related
if name == fullname:
# Must be sent last
continue

Loading…
Cancel
Save