1
0
forked from VimPlug/jedi

Merge the FileNotFoundError cache.

This commit is contained in:
Dave Halter
2017-03-23 09:58:28 +01:00
committed by Andy Lee
2 changed files with 42 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ import pickle
from jedi import settings
from jedi import debug
from jedi._compatibility import FileNotFoundError
def underscore_memoization(func):
@@ -128,12 +129,15 @@ class ParserPickling(object):
# the pickle file is outdated
return None
with open(self._get_hashed_path(grammar, path), 'rb') as f:
try:
gc.disable()
parser_cache_item = pickle.load(f)
finally:
gc.enable()
try:
with open(self._get_hashed_path(grammar, path), 'rb') as f:
try:
gc.disable()
parser_cache_item = pickle.load(f)
finally:
gc.enable()
except FileNotFoundError:
return None
debug.dbg('pickle loaded: %s', path)
parser_cache[path] = parser_cache_item