From 76417cc3c18b4d8e0bab961579285010a14fe83d Mon Sep 17 00:00:00 2001 From: Bet4 <16643669+bet4it@users.noreply.github.com> Date: Sun, 16 Dec 2018 01:37:29 +0800 Subject: [PATCH] Fix environment cache regression (#1238) The only remaining issue with this PR is that it does compare with executable instead of _start_executable (they don't need to be the same). --- jedi/api/environment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jedi/api/environment.py b/jedi/api/environment.py index 2bf6f68a..ea34d90b 100644 --- a/jedi/api/environment.py +++ b/jedi/api/environment.py @@ -190,8 +190,9 @@ def get_default_environment(): def get_cached_default_environment(): + var = os.environ.get('VIRTUAL_ENV') environment = _get_cached_default_environment() - if environment.path != os.environ.get('VIRTUAL_ENV'): + if var and var != environment.path: _get_cached_default_environment.clear_cache() return _get_cached_default_environment() return environment