diff options
author | Petri Lehtinen <petri@digip.org> | 2012-05-18 21:51:11 +0300 |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2012-05-18 21:51:11 +0300 |
commit | fb2091578e1f57e6ea1c8045701cdcdf22ff3421 (patch) | |
tree | 49bc41fdc491ab7526f595257fdba5089cd04007 /Lib/pyclbr.py | |
parent | 666cb5f9bfe65e5811ed43d6845263ad4ad61461 (diff) | |
download | cpython-fb2091578e1f57e6ea1c8045701cdcdf22ff3421.tar.gz |
#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 52cbdd53ab..65e9fbedfd 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 |