mirror of
https://github.com/python/cpython.git
synced 2025-08-19 00:00:48 +00:00
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:
parent
893653357c
commit
63eefc3567
3 changed files with 22 additions and 1 deletions
|
@ -28,7 +28,7 @@ deactivate () {
|
|||
fi
|
||||
|
||||
unset VIRTUAL_ENV
|
||||
if [ ! "$1" = "nondestructive" ] ; then
|
||||
if [ ! "${1:-}" = "nondestructive" ] ; then
|
||||
# Self destruct!
|
||||
unset -f deactivate
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue