summaryrefslogtreecommitdiffstats
path: root/Lib/pyclbr.py
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2012-05-18 18:51:11 (GMT)
committerPetri Lehtinen <petri@digip.org>2012-05-18 18:54:25 (GMT)
commit280e9f7ce5c441658c48680299e3e40ec76b03ed (patch)
tree61824b18572dcd0d517a5bda4fcea53b857f1369 /Lib/pyclbr.py
parent491ef97f7539fc376d9926c3d6548f8ca4351fea (diff)
downloadcpython-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.py2
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