[Python-checkins] venv: Suppress warning message when bash hashing is disabled. (GH-17966)

Vinay Sajip webhook-mailer at python.org
Tue Jan 14 15:48:07 EST 2020


https://github.com/python/cpython/commit/4b0d91aab4cfba30a2a9728e9eaea15dbc0ba9bd
commit: 4b0d91aab4cfba30a2a9728e9eaea15dbc0ba9bd
branch: master
author: Dima <43349662+d-goldin at users.noreply.github.com>
committer: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: 2020-01-14T20:47:59Z
summary:

venv: Suppress warning message when bash hashing is disabled. (GH-17966)

When using python's built-in venv activaton script
warnings are printed when hashing is disabled in
bash or zsh, like;

`bash: hash: hashing disabled`

This output is not really useful to the end-user and has
been disabled in `virtualenv` for long.

This commit is based on:
https://github.com/pypa/virtualenv/commit/28e85bcd80d04b2a7ebce0e1d0b02d432b7e5593

files:
M Lib/venv/scripts/common/activate

diff --git a/Lib/venv/scripts/common/activate b/Lib/venv/scripts/common/activate
index b1b4625fdddc3..45af3536aa191 100644
--- a/Lib/venv/scripts/common/activate
+++ b/Lib/venv/scripts/common/activate
@@ -18,7 +18,7 @@ deactivate () {
     # be called to get it to forget past commands.  Without forgetting
     # past commands the $PATH changes we made may not be respected
     if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
-        hash -r
+        hash -r 2> /dev/null
     fi
 
     if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
@@ -62,5 +62,5 @@ fi
 # be called to get it to forget past commands.  Without forgetting
 # past commands the $PATH changes we made may not be respected
 if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
-    hash -r
+    hash -r 2> /dev/null
 fi



More information about the Python-checkins mailing list