From 26943f6b5baea29818612ef10a66c8843259f919 Mon Sep 17 00:00:00 2001 From: Dario Gjorgjevski Date: Tue, 12 Jan 2021 11:04:36 +0100 Subject: [PATCH] Allow unfunctioing pydoc to fail (#2049) --- docs/changelog/2049.bugfix.rst | 4 ++++ src/virtualenv/activation/bash/activate.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/2049.bugfix.rst diff --git a/docs/changelog/2049.bugfix.rst b/docs/changelog/2049.bugfix.rst new file mode 100644 index 000000000..7ad254b8f --- /dev/null +++ b/docs/changelog/2049.bugfix.rst @@ -0,0 +1,4 @@ +Allow unfunctioning of pydoc to fail freely so that virtualenvs can be +activated under Zsh with set -e (since otherwise ``unset -f`` and +``unfunction`` exit with 1 if the function does not exist in Zsh) - by +:user:`d125q`. diff --git a/src/virtualenv/activation/bash/activate.sh b/src/virtualenv/activation/bash/activate.sh index 222d98204..4981be123 100644 --- a/src/virtualenv/activation/bash/activate.sh +++ b/src/virtualenv/activation/bash/activate.sh @@ -8,7 +8,7 @@ if [ "${BASH_SOURCE-}" = "$0" ]; then fi deactivate () { - unset -f pydoc >/dev/null 2>&1 + unset -f pydoc >/dev/null 2>&1 || true # reset old environment variables # ! [ -z ${VAR+_} ] returns true if VAR is declared at all