diff options
author | Victor Stinner <vstinner@python.org> | 2022-05-05 23:34:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 23:34:11 (GMT) |
commit | ada8b6d1b1b02ae7c38f161c2a0ad866559fe18b (patch) | |
tree | 2da5c4813d3cf360a121a49268aa9fd2c9fe3cbb /Doc/whatsnew | |
parent | f6dd14c65336cda4e2ebccbc6408dfe3b0a68a34 (diff) | |
download | cpython-ada8b6d1b1b02ae7c38f161c2a0ad866559fe18b.zip cpython-ada8b6d1b1b02ae7c38f161c2a0ad866559fe18b.tar.gz cpython-ada8b6d1b1b02ae7c38f161c2a0ad866559fe18b.tar.bz2 |
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 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.11.rst | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 2f32b56..87dc5dd 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -362,6 +362,11 @@ Other Language Changes pickles instance attributes implemented as :term:`slots <__slots__>`. (Contributed by Serhiy Storchaka in :issue:`26579`.) +* Add :option:`-P` command line option and :envvar:`PYTHONSAFEPATH` environment + variable to not prepend a potentially unsafe path to :data:`sys.path` such as + the current directory, the script's directory or an empty string. + (Contributed by Victor Stinner in :gh:`57684`.) + Other CPython Implementation Changes ==================================== @@ -636,6 +641,9 @@ sys (equivalent to ``sys.exc_info()[1]``). (Contributed by Irit Katriel in :issue:`46328`.) +* Add the :data:`sys.flags.safe_path <sys.flags>` flag. + (Contributed by Victor Stinner in :gh:`57684`.) + sysconfig --------- @@ -1480,6 +1488,8 @@ New Features representation of exceptions. (Contributed by Irit Katriel in :issue:`46343`.) +* Added the :c:member:`PyConfig.safe_path` member. + (Contributed by Victor Stinner in :gh:`57684`.) Porting to Python 3.11 ---------------------- |