File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,15 @@ importing them first. Its main use is to implement the :option:`-m` command
1414line switch that allows scripts to be located using the Python module
1515namespace rather than the filesystem.
1616
17+ Note that this is *not * a sandbox module - all code is executed in the
18+ current process, and any side effects (such as cached imports of other
19+ modules) will remain in place after the functions have returned.
20+
21+ Furthermore, any functions and classes defined by the executed code are not
22+ guaranteed to work correctly after a :mod: `runpy ` function has returned.
23+ If that limitation is not acceptable for a given use case, :mod: `importlib `
24+ is likely to be a more suitable choice than this module.
25+
1726The :mod: `runpy ` module provides two functions:
1827
1928
@@ -141,3 +150,5 @@ The :mod:`runpy` module provides two functions:
141150 PEP written and implemented by Nick Coghlan.
142151
143152 :ref: `using-on-general ` - CPython command line details
153+
154+ The :func: `importlib.import_module ` function
Original file line number Diff line number Diff line change @@ -384,6 +384,9 @@ Build
384384Documentation
385385-------------
386386
387+ - Issue #15230: Clearly document some of the limitations of the runpy
388+ module and nudge readers towards importlib when appropriate.
389+
387390- Issue #13557: Clarify effect of giving two different namespaces to exec or
388391 execfile().
389392
You can’t perform that action at this time.
0 commit comments