Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 85081:dd0d751cc7f1
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.
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Sat, 10 Aug 2013 16:36:18 +0200 |
| parents | 31796b188bec |
| children | 6cb3ae431bef |
line wrap: on
line diff
--- a/Python/sysmodule.c Sat Aug 10 05:58:10 2013 -0700 +++ b/Python/sysmodule.c Sat Aug 10 16:36:18 2013 +0200 @@ -1369,6 +1369,7 @@ {"bytes_warning", "-b"}, {"quiet", "-q"}, {"hash_randomization", "-R"}, + {"isolated", "-I"}, {0} }; @@ -1376,7 +1377,7 @@ "sys.flags", /* name */ flags__doc__, /* doc */ flags_fields, /* fields */ - 12 + 13 }; static PyObject* @@ -1406,6 +1407,7 @@ SetFlag(Py_BytesWarningFlag); SetFlag(Py_QuietFlag); SetFlag(Py_HashRandomizationFlag); + SetFlag(Py_IsolatedFlag); #undef SetFlag if (PyErr_Occurred()) { @@ -1944,7 +1946,7 @@ 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
