diff options
author | Petri Lehtinen <petri@digip.org> | 2012-05-18 18:51:11 (GMT) |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2012-05-18 18:59:49 (GMT) |
commit | 43ae3ceab8dd65d184aef1773714a604984de38e (patch) | |
tree | 67f19442c468077fd4e32c8f8f35d6fdbe6234d3 /Lib/pyclbr.py | |
parent | ed3639595aabd3913088c830d345e7db88d9060d (diff) | |
parent | 8d886046821f1cd43147c340b04ee0f067157749 (diff) | |
download | cpython-43ae3ceab8dd65d184aef1773714a604984de38e.zip cpython-43ae3ceab8dd65d184aef1773714a604984de38e.tar.gz cpython-43ae3ceab8dd65d184aef1773714a604984de38e.tar.bz2 |
#14798: pyclbr now raises ImportError instead of KeyError for missing packages
Diffstat (limited to 'Lib/pyclbr.py')
-rw-r--r-- | Lib/pyclbr.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/pyclbr.py b/Lib/pyclbr.py index 4cd85b9..9ec05ee 100644 --- a/Lib/pyclbr.py +++ b/Lib/pyclbr.py @@ -130,6 +130,8 @@ def _readmodule(module, path, inpackage=None): parent = _readmodule(package, path, inpackage) if inpackage is not None: package = "%s.%s" % (inpackage, package) + if not '__path__' in parent: + raise ImportError('No package named {}'.format(package)) return _readmodule(submodule, parent['__path__'], package) # Search the path for the module |