diff options
author | Victor Stinner <vstinner@python.org> | 2022-05-06 01:34:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 01:34:11 +0200 |
commit | ada8b6d1b1b02ae7c38f161c2a0ad866559fe18b (patch) | |
tree | 2da5c4813d3cf360a121a49268aa9fd2c9fe3cbb /Programs/_bootstrap_python.c | |
parent | f6dd14c65336cda4e2ebccbc6408dfe3b0a68a34 (diff) | |
download | cpython-git-ada8b6d1b1b02ae7c38f161c2a0ad866559fe18b.tar.gz |
gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)
Add the -P command line option and the PYTHONSAFEPATH environment
variable to not prepend a potentially unsafe path to sys.path.
* Add sys.flags.safe_path flag.
* Add PyConfig.safe_path member.
* Programs/_bootstrap_python.c uses config.safe_path=0.
* Update subprocess._optim_args_from_interpreter_flags() to handle
the -P command line option.
* Modules/getpath.py sets safe_path to 1 if a "._pth" file is
present.
Diffstat (limited to 'Programs/_bootstrap_python.c')
-rw-r--r-- | Programs/_bootstrap_python.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Programs/_bootstrap_python.c b/Programs/_bootstrap_python.c index f6b49c8c80..6ecbf0c72b 100644 --- a/Programs/_bootstrap_python.c +++ b/Programs/_bootstrap_python.c @@ -71,6 +71,7 @@ main(int argc, char **argv) config.parse_argv = 1; // add current script dir to sys.path config.isolated = 0; + config.safe_path = 0; #ifdef MS_WINDOWS status = PyConfig_SetArgv(&config, argc, argv); |