parent: Fix ModuleForwarder not sending related packages

Found due to a LGTM warning about unused loop variable (related). As far
as I can tell the callback was sending fullname multiple times. KeyError
check added because I found NestedTest failed - mitogen.parent had
mitogen as one of it's related, and mitogen was not in the cache.

Refs #61
wip-fakessh-exit-status
Alex Willmer 6 years ago committed by David Wilson
parent 227cd3aa60
commit d4a546dcbc

@ -519,7 +519,14 @@ class ModuleForwarder(object):
tup = self.importer._cache[fullname]
if tup is not None:
for related in tup[4]:
rtup = self.importer._cache[fullname]
LOG.debug('%r._on_get_module(): trying related %r',
self, related)
try:
rtup = self.importer._cache[related]
except KeyError:
LOG.warn('%r._on_get_module(): skipping %r, not in cache',
self, related)
continue
self._send_one_module(msg, rtup)
self._send_one_module(msg, tup)

Loading…
Cancel
Save