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:56:36 (GMT) |
commit | 8d886046821f1cd43147c340b04ee0f067157749 (patch) | |
tree | c46b43c88321138073c3c3d566a2fdc8382f1ed9 /Lib/pyclbr.py | |
parent | 1033b310a34f65a1c976bdfe974e44cfcd9f0d1e (diff) | |
download | cpython-8d886046821f1cd43147c340b04ee0f067157749.zip cpython-8d886046821f1cd43147c340b04ee0f067157749.tar.gz cpython-8d886046821f1cd43147c340b04ee0f067157749.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 52cbdd5..65e9fbe 100644 --- a/Lib/pyclbr.py +++ b/Lib/pyclbr.py @@ -128,6 +128,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 |