summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-08-10 14:36:18 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-08-10 14:36:18 (GMT)
commitad73a9cf97770023665a1bb1c6390a3c99478139 (patch)
treeb04a3a8762fe6a99ae6c57743ebcfca6d71fe2bd /Python/sysmodule.c
parent562d9cbfe9b11b5bd23810b4ee8a111a8c9aa5b8 (diff)
downloadcpython-ad73a9cf97770023665a1bb1c6390a3c99478139.zip
cpython-ad73a9cf97770023665a1bb1c6390a3c99478139.tar.gz
cpython-ad73a9cf97770023665a1bb1c6390a3c99478139.tar.bz2
Issue #16400: Add command line option for isolated mode.
-I Run Python in isolated mode. This also implies -E and -s. In isolated mode sys.path contains neither the script’s directory nor the user’s site-packages directory. All PYTHON* environment variables are ignored, too. Further restrictions may be imposed to prevent the user from injecting malicious code.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 754bcfe..72004f8a 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1369,6 +1369,7 @@ static PyStructSequence_Field flags_fields[] = {
{"bytes_warning", "-b"},
{"quiet", "-q"},
{"hash_randomization", "-R"},
+ {"isolated", "-I"},
{0}
};
@@ -1376,7 +1377,7 @@ static PyStructSequence_Desc flags_desc = {
"sys.flags", /* name */
flags__doc__, /* doc */
flags_fields, /* fields */
- 12
+ 13
};
static PyObject*
@@ -1406,6 +1407,7 @@ make_flags(void)
SetFlag(Py_BytesWarningFlag);
SetFlag(Py_QuietFlag);
SetFlag(Py_HashRandomizationFlag);
+ SetFlag(Py_IsolatedFlag);
#undef SetFlag
if (PyErr_Occurred()) {
@@ -1944,7 +1946,7 @@ PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath)
void
PySys_SetArgv(int argc, wchar_t **argv)
{
- PySys_SetArgvEx(argc, argv, 1);
+ PySys_SetArgvEx(argc, argv, Py_IsolatedFlag == 0);
}
/* Reimplementation of PyFile_WriteString() no calling indirectly