1
0
forked from VimPlug/jedi

Cache the subprocess results

This commit is contained in:
Dave Halter
2017-12-14 22:23:59 +01:00
parent 94e2e92888
commit 9d094b68f3

View File

@@ -275,6 +275,18 @@ class AccessHandle(object):
#print >> sys.stderr, name
#print('getattr', name, file=sys.stderr)
def compiled_method(*args, **kwargs):
return partial(self._workaround, name)
def _workaround(self, name, *args, **kwargs):
"""
TODO Currently we're passing slice objects around. This should not
happen. They are also the only unhashable objects that we're passing
around.
"""
if args and isinstance(args[0], slice):
return self._subprocess.get_compiled_method_return(self.id, name, *args, **kwargs)
return compiled_method
return self._cached_results(name, *args, **kwargs)
@memoize_method
def _cached_results(self, name, *args, **kwargs):
return self._subprocess.get_compiled_method_return(self.id, name, *args, **kwargs)