summaryrefslogtreecommitdiffstats
path: root/Doc/library/importlib.rst
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-05-31 22:11:17 (GMT)
committerBrett Cannon <brett@python.org>2013-05-31 22:11:17 (GMT)
commitb60a43eabf0ee17599caec484f4fe472cb4f36fe (patch)
treeb74fc162f77bdb416cc05cf74542acd6605d3aa6 /Doc/library/importlib.rst
parent028d51236a3e056288c207dd61f780e2ce5f22e1 (diff)
downloadcpython-b60a43eabf0ee17599caec484f4fe472cb4f36fe.zip
cpython-b60a43eabf0ee17599caec484f4fe472cb4f36fe.tar.gz
cpython-b60a43eabf0ee17599caec484f4fe472cb4f36fe.tar.bz2
Add a reset_name argument to importlib.util.module_to_load in order to
control whether to reset the module's __name__ attribute in case a reload is being done.
Diffstat (limited to 'Doc/library/importlib.rst')
-rw-r--r--Doc/library/importlib.rst6
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index 976451c..35336b1 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -788,7 +788,7 @@ an :term:`importer`.
.. versionadded:: 3.3
-.. function:: module_to_load(name)
+.. function:: module_to_load(name, *, reset_name=True)
Returns a :term:`context manager` which provides the module to load. The
module will either come from :attr:`sys.modules` in the case of reloading or
@@ -796,6 +796,10 @@ an :term:`importer`.
:attr:`sys.modules` occurs if the module was new and an exception was
raised.
+ If **reset_name** is true and the module requested is being reloaded then
+ the module's :attr:`__name__` attribute will
+ be reset to **name**, else it will be left untouched.
+
.. versionadded:: 3.4
.. decorator:: module_for_loader