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

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
```
This commit is contained in:
Daniel Abrahamsson 2019-09-11 16:58:56 +02:00 committed by T. Wouters
parent 3b58a70d9c
commit 5209e586b7
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