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:54:25 (GMT) |
commit | 280e9f7ce5c441658c48680299e3e40ec76b03ed (patch) | |
tree | 61824b18572dcd0d517a5bda4fcea53b857f1369 /Lib/pyclbr.py | |
parent | 491ef97f7539fc376d9926c3d6548f8ca4351fea (diff) | |
download | cpython-280e9f7ce5c441658c48680299e3e40ec76b03ed.zip cpython-280e9f7ce5c441658c48680299e3e40ec76b03ed.tar.gz cpython-280e9f7ce5c441658c48680299e3e40ec76b03ed.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 97f74f1..b8f71ae 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 |