Close issue #16163: handle submodules in pkgutil.iter_importers

This commit is contained in:
Nick Coghlan 2013-04-14 22:30:42 +10:00
parent 8157459d6b
commit c4e0d982f3
3 changed files with 44 additions and 2 deletions

View file

@ -451,8 +451,8 @@ def iter_importers(fullname=""):
if '.' in fullname:
# Get the containing package's __path__
pkg_name = fullname.rpartition(".")[0]
pkg = importlib.import_module(pkg)
path = getattr(sys.modules[pkg], '__path__', None)
pkg = importlib.import_module(pkg_name)
path = getattr(pkg, '__path__', None)
if path is None:
return
else: