From 07186c3959a61c3d73b5ccae431cdd32afe70e5e Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Mon, 16 Sep 2019 05:21:03 -0700 Subject: [PATCH] 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 (cherry picked from commit bdd6945d4dbd1fe6a7fcff95f7d6908db7d791a1) Co-authored-by: Xtreak --- Doc/using/cmdline.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 50143f2bd0..69169d7b14 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::