Do not cache Python interpreter path

This commit is contained in:
micbou 2016-11-07 16:36:38 +01:00
parent 2febf9bacc
commit c14459dd58
No known key found for this signature in database
GPG Key ID: C7E8FD1F3BDA1E05

View File

@ -25,7 +25,6 @@ from builtins import * # noqa
import os import os
import sys import sys
import vim import vim
import functools
import re import re
# Can't import these from setup.py because it makes nosetests go crazy. # Can't import these from setup.py because it makes nosetests go crazy.
@ -37,19 +36,9 @@ PYTHON_BINARY_REGEX = re.compile(
r'python((2(\.[67])?)|(3(\.[3-9])?))?(.exe)?$', re.IGNORECASE ) r'python((2(\.[67])?)|(3(\.[3-9])?))?(.exe)?$', re.IGNORECASE )
def Memoize( obj ): # Not caching the result of this function; users shouldn't have to restart Vim
cache = obj.cache = {} # after running the install script or setting the
# `g:ycm_server_python_interpreter` option.
@functools.wraps( obj )
def memoizer( *args, **kwargs ):
key = str( args ) + str( kwargs )
if key not in cache:
cache[ key ] = obj( *args, **kwargs )
return cache[ key ]
return memoizer
@Memoize
def PathToPythonInterpreter(): def PathToPythonInterpreter():
# Not calling the Python interpreter to check its version as it significantly # Not calling the Python interpreter to check its version as it significantly
# impacts startup time. # impacts startup time.