mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
#14798: pyclbr now raises ImportError instead of KeyError for missing packages
This commit is contained in:
commit
43ae3ceab8
4 changed files with 12 additions and 0 deletions
|
@ -130,6 +130,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue