importer: take priority over system packages when whitelisting is enabled

Might want to de-overload the meaning of whitelist in future, but in
the meantime it works fine for Ansible and I can't think of a
whitelisting use case that would break because of it.

Closes #114.
wip-fakessh-exit-status
David Wilson 7 years ago
parent b63af1de85
commit 28afa955a3

@ -482,6 +482,11 @@ class Importer(object):
self, fullname) self, fullname)
return None return None
# #114: explicitly whitelisted prefixes override any
# system-installed package.
if self.whitelist and not is_blacklisted_import(self, fullname):
return self
try: try:
self.builtin_find_module(fullname) self.builtin_find_module(fullname)
_v and LOG.debug('%r: %r is available locally', self, fullname) _v and LOG.debug('%r: %r is available locally', self, fullname)

Loading…
Cancel
Save