[Python-checkins] bpo-33095: Add reference to isolated mode in -m and script option (GH-7764)
Nick Coghlan
webhook-mailer at python.org
Fri Sep 13 20:35:49 EDT 2019
https://github.com/python/cpython/commit/bdd6945d4dbd1fe6a7fcff95f7d6908db7d791a1
commit: bdd6945d4dbd1fe6a7fcff95f7d6908db7d791a1
branch: master
author: Xtreak <tir.karthi at gmail.com>
committer: Nick Coghlan <ncoghlan at gmail.com>
date: 2019年09月14日T10:35:44+10:00
summary:
bpo-33095: Add reference to isolated mode in -m and script option (GH-7764)
Attempt to make isolated mode easier to discover via additional inline documentation.
Co-Authored-By: Julien Palard <julien at palard.fr>
files:
M Doc/using/cmdline.rst
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst
index d04c3b61dd5b..457a7fcb6d9e 100644
--- a/Doc/using/cmdline.rst
+++ b/Doc/using/cmdline.rst
@@ -101,6 +101,11 @@ source.
first element will be set to ``"-m"``). As with the :option:`-c` option,
the current directory will be added to the start of :data:`sys.path`.
+ :option:`-I` option can be used to run the script in isolated mode where
+ :data:`sys.path` contains neither the current directory nor the user's
+ site-packages directory. All :envvar:`PYTHON*` environment variables are
+ ignored, too.
+
Many standard library modules contain code that is invoked on their execution
as a script. An example is the :mod:`timeit` module::
@@ -121,6 +126,7 @@ source.
.. versionchanged:: 3.4
namespace packages are also supported
+.. _cmdarg-dash:
.. describe:: -
@@ -133,6 +139,8 @@ source.
.. audit-event:: cpython.run_stdin "" ""
+.. _cmdarg-script:
+
.. describe:: <script>
Execute the Python code contained in *script*, which must be a filesystem
@@ -151,6 +159,11 @@ source.
added to the start of :data:`sys.path` and the ``__main__.py`` file in
that location is executed as the :mod:`__main__` module.
+ :option:`-I` option can be used to run the script in isolated mode where
+ :data:`sys.path` contains neither the script's directory nor the user's
+ site-packages directory. All :envvar:`PYTHON*` environment variables are
+ ignored, too.
+
.. audit-event:: cpython.run_file filename
.. seealso::
More information about the Python-checkins
mailing list