1
0
forked from VimPlug/jedi

Fix an issue in Python 2.

This commit is contained in:
Dave Halter
2017-03-31 21:03:15 +02:00
parent f6f2765ab9
commit 7a51dbea08

View File

@@ -6,6 +6,7 @@ import gc
import shutil import shutil
import pickle import pickle
import platform import platform
import errno
from jedi import settings from jedi import settings
from jedi import debug from jedi import debug
@@ -76,10 +77,17 @@ def load_module(grammar, path):
def _load_from_file_system(grammar, path, p_time): def _load_from_file_system(grammar, path, p_time):
cache_path = _get_hashed_path(grammar, path) cache_path = _get_hashed_path(grammar, path)
try:
try: try:
if p_time > os.path.getmtime(cache_path): if p_time > os.path.getmtime(cache_path):
# Cache is outdated # Cache is outdated
return None return None
except OSError as e:
if e.errno == errno.ENOENT:
# In Python 2 instead of an IOError here we get an OSError.
raise FileNotFoundError
else:
raise
with open(cache_path, 'rb') as f: with open(cache_path, 'rb') as f:
gc.disable() gc.disable()