]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.10] gh-93858: Prevent error when activating venv in nested fish instances (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 18 Oct 2022 15:39:06 +0000 (08:39 -0700)
committerGitHub <noreply@github.com>
Tue, 18 Oct 2022 15:39:06 +0000 (16:39 +0100)
Co-authored-by: Thomas B. Brunner <thomasbbrunner@gmail.com>
Lib/venv/scripts/posix/activate.fish
Misc/NEWS.d/next/Library/2022-06-17-12-02-30.gh-issue-93858.R49ARc.rst [new file with mode: 0644]

index e40a1d714894fa3dca02c2e2c81c32821cd7b05b..9aa4446005f4d80337a3a1952871812b62804241 100644 (file)
@@ -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 (file)
index 0000000..508ba62
--- /dev/null
@@ -0,0 +1 @@
+Prevent error when activating venv in nested fish instances.