summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-23 16:54:20 (GMT)
committerGitHub <noreply@github.com>2018-11-23 16:54:20 (GMT)
commit9de363271519e0616f4a7b59427057c4810d3acc (patch)
tree00c24caf2c5762de38fed2bef4346bbf355fcb42 /Lib/subprocess.py
parentba57963a95a994947b8bec6869e810a74a751278 (diff)
downloadcpython-9de363271519e0616f4a7b59427057c4810d3acc.zip
cpython-9de363271519e0616f4a7b59427057c4810d3acc.tar.gz
cpython-9de363271519e0616f4a7b59427057c4810d3acc.tar.bz2
bpo-34812: subprocess._args_from_interpreter_flags(): add isolated (GH-10675)
The "-I" command line option (run Python in isolated mode) is now also copied by the multiprocessing and distutils modules when spawning child processes. Previously, only -E and -s options (enabled by -I) were copied. subprocess._args_from_interpreter_flags() now copies the -I flag.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 5db6f0c..6966176 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -262,9 +262,7 @@ def _args_from_interpreter_flags():
# 'inspect': 'i',
# 'interactive': 'i',
'dont_write_bytecode': 'B',
- 'no_user_site': 's',
'no_site': 'S',
- 'ignore_environment': 'E',
'verbose': 'v',
'bytes_warning': 'b',
'quiet': 'q',
@@ -276,6 +274,14 @@ def _args_from_interpreter_flags():
if v > 0:
args.append('-' + opt * v)
+ if sys.flags.isolated:
+ args.append('-I')
+ else:
+ if sys.flags.ignore_environment:
+ args.append('-E')
+ if sys.flags.no_user_site:
+ args.append('-s')
+
# -W options
warnopts = sys.warnoptions[:]
bytes_warning = sys.flags.bytes_warning