summaryrefslogtreecommitdiff
path: root/Doc/library/imp.rst
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2017-02-09 16:08:17 +0100
committerNick Coghlan <ncoghlan@gmail.com>2017-02-09 16:08:17 +0100
commitc6180bb73c8c7c7f9d8ea9816487b710597b6fc1 (patch)
treefb4a5c18886537b4b7df46ed3b2aa579747ff507 /Doc/library/imp.rst
parent5e0114a832a903518c4af6983161c0c2a8942a24 (diff)
parent819a21a3a4aac38f32e1ba4f68bcef45591fa3f0 (diff)
downloadcpython-c6180bb73c8c7c7f9d8ea9816487b710597b6fc1.tar.gz
Merge issue #26355 fix from Python 3.5
Diffstat (limited to 'Doc/library/imp.rst')
-rw-r--r--Doc/library/imp.rst15
1 files changed, 10 insertions, 5 deletions
diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst
index 9828ba6fe2..ccf5f92d16 100644
--- a/Doc/library/imp.rst
+++ b/Doc/library/imp.rst
@@ -85,7 +85,9 @@ This module provides an interface to the mechanisms used to implement the
.. deprecated:: 3.3
Use :func:`importlib.util.find_spec` instead unless Python 3.3
compatibility is required, in which case use
- :func:`importlib.find_loader`.
+ :func:`importlib.find_loader`. For example usage of the former case,
+ see the :ref:`importlib-examples` section of the :mod:`importlib`
+ documentation.
.. function:: load_module(name, file, pathname, description)
@@ -112,9 +114,12 @@ This module provides an interface to the mechanisms used to implement the
If previously used in conjunction with :func:`imp.find_module` then
consider using :func:`importlib.import_module`, otherwise use the loader
returned by the replacement you chose for :func:`imp.find_module`. If you
- called :func:`imp.load_module` and related functions directly then use the
- classes in :mod:`importlib.machinery`, e.g.
- ``importlib.machinery.SourceFileLoader(name, path).load_module()``.
+ called :func:`imp.load_module` and related functions directly with file
+ path arguments then use a combination of
+ :func:`importlib.util.spec_from_file_location` and
+ :func:`importlib.util.module_from_spec`. See the :ref:`importlib-examples`
+ section of the :mod:`importlib` documentation for details of the various
+ approaches.
.. function:: new_module(name)
@@ -123,7 +128,7 @@ This module provides an interface to the mechanisms used to implement the
in ``sys.modules``.
.. deprecated:: 3.4
- Use :class:`types.ModuleType` instead.
+ Use :func:`importlib.util.module_from_spec` instead.
.. function:: reload(module)