1
0
forked from VimPlug/jedi

_get_virtual_env_from_var: use safe=False

Without this creating an env from VIRTUAL_ENV will always silently fail
if it is not the same/current environment.
This commit is contained in:
Daniel Hahler
2018-08-13 17:44:19 +02:00
committed by Dave Halter
parent cdb760487b
commit 56bd795100
2 changed files with 25 additions and 1 deletions

View File

@@ -147,13 +147,18 @@ class InterpreterEnvironment(_BaseEnvironment):
def _get_virtual_env_from_var():
"""Get virtualenv environment from VIRTUAL_ENV environment variable.
It uses `safe=False` with ``create_environment``, because the environment
variable is considered to be safe / controlled by the user solely.
"""
var = os.environ.get('VIRTUAL_ENV')
if var is not None:
if var == sys.prefix:
return SameEnvironment()
try:
return create_environment(var)
return create_environment(var, safe=False)
except InvalidPythonEnvironment:
pass