forked from VimPlug/jedi
Fix an issue in Python 2.
This commit is contained in:
@@ -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
|
||||||
@@ -77,9 +78,16 @@ 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:
|
||||||
if p_time > os.path.getmtime(cache_path):
|
try:
|
||||||
# Cache is outdated
|
if p_time > os.path.getmtime(cache_path):
|
||||||
return None
|
# Cache is outdated
|
||||||
|
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()
|
||||||
|
|||||||
Reference in New Issue
Block a user