diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 110e7e5d7fb9a7..8a621c03d9fe5a 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1968,7 +1968,7 @@ are always available. They are listed here in alphabetical order. This is an advanced function that is not needed in everyday Python programming, unlike :func:`importlib.import_module`. - This function is invoked by the :keyword:`import` statement. It can be + This function is invoked by the :keyword:`import` statement. It can be replaced (by importing the :mod:`builtins` module and assigning to ``builtins.__import__``) in order to change semantics of the :keyword:`!import` statement, but doing so is **strongly** discouraged as it @@ -2018,6 +2018,9 @@ are always available. They are listed here in alphabetical order. object, the names to import are retrieved and assigned to their respective names. + An :exc:`ImportError` exception can be raised if the module cannot be imported + successfully. + If you simply want to import a module (potentially within a package) by name, use :func:`importlib.import_module`. diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 3fc1531c0cdf19..06cd62541db195 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -124,6 +124,9 @@ Functions need to call :func:`invalidate_caches` in order for the new module to be noticed by the import system. + An :exc:`ImportError` exception can be raised if the module cannot be imported + successfully. + .. versionchanged:: 3.3 Parent packages are automatically imported.