[Python-checkins] [3.10] gh-93858: Prevent error when activating venv in nested fish instances (GH-93931) (GH-98403)

vsajip webhook-mailer at python.org
Tue Oct 18 11:39:12 EDT 2022


https://github.com/python/cpython/commit/ce87ab4dc5683fcc990c05e3875eff982824a144
commit: ce87ab4dc5683fcc990c05e3875eff982824a144
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: vsajip <vinay_sajip at yahoo.co.uk>
date: 2022-10-18T16:39:06+01:00
summary:

[3.10] gh-93858: Prevent error when activating venv in nested fish instances (GH-93931) (GH-98403)

Co-authored-by: Thomas B. Brunner <thomasbbrunner at gmail.com>

files:
A Misc/NEWS.d/next/Library/2022-06-17-12-02-30.gh-issue-93858.R49ARc.rst
M Lib/venv/scripts/posix/activate.fish

diff --git a/Lib/venv/scripts/posix/activate.fish b/Lib/venv/scripts/posix/activate.fish
index e40a1d714894..9aa4446005f4 100644
--- a/Lib/venv/scripts/posix/activate.fish
+++ b/Lib/venv/scripts/posix/activate.fish
@@ -13,10 +13,13 @@ function deactivate  -d "Exit virtual environment and return to normal shell env
     end
 
     if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
-        functions -e fish_prompt
         set -e _OLD_FISH_PROMPT_OVERRIDE
-        functions -c _old_fish_prompt fish_prompt
-        functions -e _old_fish_prompt
+        # prevents error when using nested fish instances (Issue #93858)
+        if functions -q _old_fish_prompt
+            functions -e fish_prompt
+            functions -c _old_fish_prompt fish_prompt
+            functions -e _old_fish_prompt
+        end
     end
 
     set -e VIRTUAL_ENV
diff --git a/Misc/NEWS.d/next/Library/2022-06-17-12-02-30.gh-issue-93858.R49ARc.rst b/Misc/NEWS.d/next/Library/2022-06-17-12-02-30.gh-issue-93858.R49ARc.rst
new file mode 100644
index 000000000000..508ba626bab4
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-06-17-12-02-30.gh-issue-93858.R49ARc.rst
@@ -0,0 +1 @@
+Prevent error when activating venv in nested fish instances.



More information about the Python-checkins mailing list