diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2007-07-24 13:58:28 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2007-07-24 13:58:28 (GMT) |
commit | 13c25c08ca9e154e337cc7d7c258d9286304ed16 (patch) | |
tree | 4896411a1b4c6f16595dda57d4a1e13a8687fec1 /Doc/lib | |
parent | 4f82a03714ad08825bb5554988d9e2dd1fc30dd5 (diff) | |
download | cpython-13c25c08ca9e154e337cc7d7c258d9286304ed16.zip cpython-13c25c08ca9e154e337cc7d7c258d9286304ed16.tar.gz cpython-13c25c08ca9e154e337cc7d7c258d9286304ed16.tar.bz2 |
Fix an incompatibility between the -i and -m command line switches as reported on python-dev by PJE - runpy.run_module now leaves any changes it makes to the sys module intact after the function terminates
Diffstat (limited to 'Doc/lib')
-rw-r--r-- | Doc/lib/librunpy.tex | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/lib/librunpy.tex b/Doc/lib/librunpy.tex index c7a7e51..60707ca 100644 --- a/Doc/lib/librunpy.tex +++ b/Doc/lib/librunpy.tex @@ -56,9 +56,11 @@ the top level namespace of the \module{__builtin__} module. If the argument \var{alter_sys} is supplied and evaluates to \code{True}, then \code{sys.argv[0]} is updated with the value of \code{__file__} and \code{sys.modules[__name__]} is updated with a -temporary module object for the module being executed. Both -\code{sys.argv[0]} and \code{sys.modules[__name__]} are restored to -their original values before the function returns. +new module object for the module being executed. Note that neither +\code{sys.argv[0]} nor \code{sys.modules[__name__]} are restored to +their original values before the function returns - if client code +needs these values preserved, it must either save them explicitly or +else avoid enabling the automatic alterations to \module{sys}. Note that this manipulation of \module{sys} is not thread-safe. Other threads may see the partially initialised module, as well as the |