From 3eda2013a6e2a9d509cd22810522ab74db6e295e Mon Sep 17 00:00:00 2001 From: Dario Gjorgjevski Date: Tue, 12 Jan 2021 09:56:03 +0100 Subject: [PATCH 1/2] Allow unfunctioing pydoc to fail Otherwise, one cannot activate a virtualenv under Zsh with set -e. --- src/virtualenv/activation/bash/activate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 1e1b76d3a1f5b7521c943fb4fccfefbec2987c74 Mon Sep 17 00:00:00 2001 From: Dario Gjorgjevski Date: Tue, 12 Jan 2021 10:49:09 +0100 Subject: [PATCH 2/2] Add changelog fragment --- docs/changelog/2049.bugfix.rst | 4 ++++ 1 file changed, 4 insertions(+) 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`.