https://github.com/python/cpython/commit/5049eb1d29f6b10722f11439ab2576e0ffc903f4
commit: 5049eb1d29f6b10722f11439ab2576e0ffc903f4
branch: main
author: Ronan Pigott <[email protected]>
committer: FFY00 <[email protected]>
date: 2026-06-22T15:40:23+01:00
summary:

gh-111501: venv: do not export PS1 in activate (#105279)

PS1 is a parameter special to the current interactive shell. It does not
need to be exported to the environment. Exporting PS1 is not useful, and
will break different shells spawned by the current interactive shell.

files:
A Misc/NEWS.d/next/Tools-Demos/2024-06-17-13-52-04.gh-issue-111501.syFLAV.rst
M Lib/venv/scripts/common/activate

diff --git a/Lib/venv/scripts/common/activate b/Lib/venv/scripts/common/activate
index 241a8650bda33aa..657e4d481f6255a 100644
--- a/Lib/venv/scripts/common/activate
+++ b/Lib/venv/scripts/common/activate
@@ -21,7 +21,6 @@ deactivate () {
 
     if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
         PS1="${_OLD_VIRTUAL_PS1:-}"
-        export PS1
         unset _OLD_VIRTUAL_PS1
     fi
 
@@ -68,7 +67,6 @@ fi
 if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
     _OLD_VIRTUAL_PS1="${PS1:-}"
     PS1="("__VENV_PROMPT__") ${PS1:-}"
-    export PS1
 fi
 
 # Call hash to forget past commands. Without forgetting
diff --git 
a/Misc/NEWS.d/next/Tools-Demos/2024-06-17-13-52-04.gh-issue-111501.syFLAV.rst 
b/Misc/NEWS.d/next/Tools-Demos/2024-06-17-13-52-04.gh-issue-111501.syFLAV.rst
new file mode 100644
index 000000000000000..2989d4b81b1dd39
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Tools-Demos/2024-06-17-13-52-04.gh-issue-111501.syFLAV.rst
@@ -0,0 +1 @@
+PS1 is no longer exported by venv activate script

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to