Issue #1559549: Add 'name' and 'path' attributes to ImportError.

Currently import does not use these attributes as they are planned
for use by importlib (which will be another commit).

Thanks to Filip Gruszczyński for the initial patch and Brian Curtin
for refining it.
This commit is contained in:
Brett Cannon 2012-04-12 20:24:54 -04:00
parent f50b38a11f
commit 79ec55e980
6 changed files with 192 additions and 3 deletions

View file

@ -159,6 +159,14 @@ The following exceptions are the exceptions that are usually raised.
Raised when an :keyword:`import` statement fails to find the module definition
or when a ``from ... import`` fails to find a name that is to be imported.
The :attr:`name` and :attr:`path` attributes can be set using keyword-only
arguments to the constructor. When set they represent the name of the module
that was attempted to be imported and the path to any file which triggered
the exception, respectively.
.. versionchanged:: 3.3
Added the :attr:`name` and :attr:`path` attributes.
.. exception:: IndexError