bpo-37885: venv: Don't produce unbound variable warning on deactivate (GH-15973)

Before, running deactivate from a bash shell configured to treat undefined variables as errors (`set -u`) would produce a warning:

```
$ python3 -m venv test
$ source test/bin/activate
(test) $ deactivate
-bash: $1: unbound variable
```
(cherry picked from commit 5209e586b7)

Co-authored-by: Daniel Abrahamsson <hamsson@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-09-11 08:55:57 -07:00 committed by T. Wouters
parent 893653357c
commit 63eefc3567
3 changed files with 22 additions and 1 deletions

View file

@ -28,7 +28,7 @@ deactivate () {
fi
unset VIRTUAL_ENV
if [ ! "$1" = "nondestructive" ] ; then
if [ ! "${1:-}" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi