Issue #14285: Do not catch exceptions initializing any ancestor package

The previous fix only handled the case of the parent package of __main__
failing to initialize.

Also make the "Error while finding spec" formatting slightly more appealing,
and document and test that the module name must be absolute.
This commit is contained in:
Martin Panter 2015-12-10 06:47:06 +00:00
parent a29eb08fb9
commit 7dda421bff
5 changed files with 31 additions and 6 deletions

View file

@ -77,7 +77,7 @@ source.
the :mod:`__main__` module.
Since the argument is a *module* name, you must not give a file extension
(``.py``). The ``module-name`` should be a valid Python module name, but
(``.py``). The module name should be a valid absolute Python module name, but
the implementation may not always enforce this (e.g. it may allow you to
use a name that includes a hyphen).