summaryrefslogtreecommitdiffstats
path: root/Doc/library/runpy.rst
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-07-14 14:36:39 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2012-07-14 14:36:39 (GMT)
commita3d1cac4b21ffbd8deed0c28f08bed4afa5e7b83 (patch)
tree7d7b4dc170830c5e51d56109d168667167270534 /Doc/library/runpy.rst
parent761bb1137445c75c4ba87d3669dd546e25277cd5 (diff)
downloadcpython-a3d1cac4b21ffbd8deed0c28f08bed4afa5e7b83.zip
cpython-a3d1cac4b21ffbd8deed0c28f08bed4afa5e7b83.tar.gz
cpython-a3d1cac4b21ffbd8deed0c28f08bed4afa5e7b83.tar.bz2
Issue #15230: Update runpy docs to clarify a couple of points that came up in this issue
Diffstat (limited to 'Doc/library/runpy.rst')
-rw-r--r--Doc/library/runpy.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/Doc/library/runpy.rst b/Doc/library/runpy.rst
index 4df622c..6919bc0 100644
--- a/Doc/library/runpy.rst
+++ b/Doc/library/runpy.rst
@@ -14,6 +14,15 @@ importing them first. Its main use is to implement the :option:`-m` command
line switch that allows scripts to be located using the Python module
namespace rather than the filesystem.
+Note that this is *not* a sandbox module - all code is executed in the
+current process, and any side effects (such as cached imports of other
+modules) will remain in place after the functions have returned.
+
+Furthermore, any functions and classes defined by the executed code are not
+guaranteed to work correctly after a :mod:`runpy` function has returned.
+If that limitation is not acceptable for a given use case, :mod:`importlib`
+is likely to be a more suitable choice than this module.
+
The :mod:`runpy` module provides two functions:
@@ -141,3 +150,5 @@ The :mod:`runpy` module provides two functions:
PEP written and implemented by Nick Coghlan.
:ref:`using-on-general` - CPython command line details
+
+ The :func:`importlib.import_module` function