Commit 37d38f8d authored by David Wilson's avatar David Wilson

importer: _is_stdlib_name() needed to handle relative paths

Was causing tons of log spam due to 'skipping absent related name'
parent 6ed731c0
......@@ -62,7 +62,8 @@ def _stdlib_paths():
]
prefixes = (getattr(sys, a) for a in attr_candidates if hasattr(sys, a))
version = 'python%s.%s' % sys.version_info[0:2]
return set(os.path.join(p, 'lib', version) for p in prefixes)
return set(os.path.abspath(os.path.join(p, 'lib', version))
for p in prefixes)
def get_child_modules(path):
......@@ -283,7 +284,7 @@ class ModuleFinder(object):
return False
# six installs crap with no __file__
modpath = getattr(module, '__file__', '')
modpath = os.path.abspath(getattr(module, '__file__', ''))
if 'site-packages' in modpath:
return False
......@@ -535,10 +536,10 @@ class ModuleResponder(object):
stream.sent_modules.add(fullname)
def _on_get_module(self, msg):
LOG.debug('%r.get_module(%r)', self, msg)
if msg == mitogen.core._DEAD:
return
LOG.debug('%r._on_get_module(%r)', self, msg.data)
stream = self._router.stream_by_id(msg.src_id)
fullname = msg.data
if fullname in stream.sent_modules:
......
......@@ -532,13 +532,10 @@ class ModuleForwarder(object):
tup = self.importer._cache[fullname]
if tup is not None:
for related in tup[4]:
LOG.debug('%r._on_get_module(): trying related %r',
self, related)
try:
rtup = self.importer._cache[related]
except KeyError:
LOG.debug('%r._on_get_module(): skipping %r, not in cache',
self, related)
rtup = self.importer._cache.get(related)
if not rtup:
LOG.debug('%r._on_get_module(): skipping absent %r',
self, related)
continue
self._send_one_module(msg, rtup)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment