New submission from Brett Cannon <br...@python.org>:

If you look at 
https://github.com/python/cpython/blob/master/Lib/venv/__init__.py#L112-L113 
you will see that the prompt context for a virtual environment is always set. 
Then if you look at the string substitutions for the activation scripts you 
will also see that the string substitution for __VENV_PROMPT__ is thus always 
done.

This is an issue as it means that for the fish and bash activation scripts they 
have erroneous checks for custom prompts. I.e. 
https://github.com/python/cpython/blob/master/Lib/venv/scripts/posix/activate.fish#L55
 for fish and 
https://github.com/python/cpython/blob/master/Lib/venv/scripts/common/activate#L57
 for bash will never fail, halting any other further checks unless one creates 
a custom EnvBuilder class which will make sure the prompt context stays empty 
all the way to string substitution. This impacts the colouring of the prompt in 
fish as that's only done if there is no default prompt (which is never true).

----------
components: Library (Lib)
messages: 348346
nosy: brett.cannon, vinay.sajip
priority: normal
severity: normal
status: open
title: venv activation scripts erroneously check if __VENV_PROMPT__ is defined
type: behavior

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37661>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to