Merge pull request #4048 from jdemeyer/unpickle_error

Turn any environment unpickling error into IOError
This commit is contained in:
Takeshi KOMIYA 2017-10-21 18:43:05 +09:00 committed by GitHub
commit 2f78acb2f9

View File

@ -110,7 +110,12 @@ class BuildEnvironment(object):
@staticmethod
def load(f, app=None):
# type: (IO, Sphinx) -> BuildEnvironment
env = pickle.load(f)
try:
env = pickle.load(f)
except Exception as exc:
# This can happen for example when the pickle is from a
# different version of Sphinx.
raise IOError(exc)
if env.version != ENV_VERSION:
raise IOError('build environment version not current')
if app: