summaryrefslogtreecommitdiffstats
path: root/Doc/library/importlib.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/importlib.rst')
-rw-r--r--Doc/library/importlib.rst11
1 files changed, 8 insertions, 3 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index 65a6850..8be6172 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -1433,13 +1433,18 @@ an :term:`importer`.
``importlib.util.resolve_name('sys', __package__)`` without doing a
check to see if the **package** argument is needed.
- :exc:`ValueError` is raised if **name** is a relative module name but
- package is a false value (e.g. ``None`` or the empty string).
- :exc:`ValueError` is also raised a relative name would escape its containing
+ :exc:`ImportError` is raised if **name** is a relative module name but
+ **package** is a false value (e.g. ``None`` or the empty string).
+ :exc:`ImportError` is also raised a relative name would escape its containing
package (e.g. requesting ``..bacon`` from within the ``spam`` package).
.. versionadded:: 3.3
+ .. versionchanged:: 3.9
+ To improve consistency with import statements, raise
+ :exc:`ImportError` instead of :exc:`ValueError` for invalid relative
+ import attempts.
+
.. function:: find_spec(name, package=None)
Find the :term:`spec <module spec>` for a module, optionally relative to