]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111501: venv: do not export PS1 in activate (#105279)
authorRonan Pigott <ronan@rjp.ie>
Mon, 22 Jun 2026 14:40:23 +0000 (07:40 -0700)
committerGitHub <noreply@github.com>
Mon, 22 Jun 2026 14:40:23 +0000 (15:40 +0100)
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.

Lib/venv/scripts/common/activate
Misc/NEWS.d/next/Tools-Demos/2024-06-17-13-52-04.gh-issue-111501.syFLAV.rst [new file with mode: 0644]

index 241a8650bda33aa1f26e671ecf8eb2cbdecfa67e..657e4d481f6255a6977366bf161d0b66daef5574 100644 (file)
@@ -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 (file)
index 0000000..2989d4b
--- /dev/null
@@ -0,0 +1 @@
+PS1 is no longer exported by venv activate script