forked from VimPlug/jedi
Merge the FileNotFoundError cache.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user