summaryrefslogtreecommitdiff
path: root/Lib/pyclbr.py
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2012-05-18 21:51:11 +0300
committerPetri Lehtinen <petri@digip.org>2012-05-18 21:51:11 +0300
commitfb2091578e1f57e6ea1c8045701cdcdf22ff3421 (patch)
tree49bc41fdc491ab7526f595257fdba5089cd04007 /Lib/pyclbr.py
parent666cb5f9bfe65e5811ed43d6845263ad4ad61461 (diff)
downloadcpython-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.py2
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